
SQL Queries for Mere Mortals
A Hands-On Guide to Data Manipulation in SQL
by John L. Viescas
4th Edition
Publisher: Addison-Wesley Professional PTG
Book Details
| Print ISBN | 9780134858333 |
| eText ISBN | 9780134858357 |
| Publisher | Addison-Wesley Professional PTG |
| Publishing Year | 2018 |
| Edition | 4th Edition |
| Language | English |
| Pages | 960 |
SQL Queries for Mere Mortals, 4th Edition by John L. Viescas is a practical guide focused on relational database principles and query creation. Designed for database administrators, developers, students, and generic database users, this text provides a structured path for constructing queries and manipulating data effectively across relational systems.
The initial sections explain relational database concepts and strategies for designing sound table structures. From these structural foundations, the volume covers fundamental query operations, including SELECT statements, expressions, filtering records with the WHERE clause, and sorting results using ORDER BY. Readers further learn how to alter existing datasets through UPDATE, INSERT, and DELETE operations.
By emphasizing a software-independent approach, the text delivers generic SQL syntax that applies across multiple relational platforms without restricting instruction to a single vendor database product. This universal instruction enables learners to build portable querying skills suitable for academic coursework, database administration, and software development.
Table of Contents
Chapter 1: What Is Relational?
- • Types of Databases
- • A Brief History of the Relational Model
- • In the Beginning . . .
- • Relational Database Systems
- • Anatomy of a Relational Database
- • Tables
- • Columns
- • Rows
- • Keys
- • Views
- • Relationships
- • What’s in It for You?
- • Where Do You Go from Here?
- • Summary
Chapter 2: Ensuring Your Database Structure Is Sound
- • Why Is this Chapter Here?
- • Why Worry about Sound Structures?
- • Fine-Tuning Columns
- • What’s in a Name? (Part One)
- • Smoothing Out the Rough Edges
- • Resolving Multipart Columns
- • Resolving Multivalued Columns
- • Fine-Tuning Tables
- • What’s in a Name? (Part Two)
- • Ensuring a Sound Structure
- • Resolving Unnecessary Duplicate Columns
- • Identification Is the Key
- • Establishing Solid Relationships
- • Establishing a Deletion Rule
- • Setting the Type of Participation
- • Setting the Degree of Participation
- • Is That All?
- • Summary
Chapter 3: A Concise History of SQL
- • The Origins of SQL
- • Early Vendor Implementations
- • “. . . And Then There Was a Standard”
- • Evolution of the ANSI/ISO Standard
- • Other SQL Standards
- • Commercial Implementations
- • What the Future Holds
- • Why Should You Learn SQL?
- • Which Version of SQL Does this Book Cover?
- • Summary
Chapter 4: Creating a Simple Query
- • Introducing SELECT
- • The SELECT Statement
- • A Quick Aside: Data versus Information
- • Translating Your Request into SQL
- • Expanding the Field of Vision
- • Using a Shortcut to Request All Columns
- • Eliminating Duplicate Rows
- • Sorting Information
- • First Things First: Collating Sequences
- • Let’s Now Come to Order
- • Saving Your Work
- • Sample Statements
- • Summary
- • Problems for You to Solve
Chapter 5: Getting More Than Simple Columns
- • What Is an Expression?
- • What Type of Data Are You Trying to Express?
- • Changing Data Types: The CAST Function
- • Specifying Explicit Values
- • Character String Literals
- • Numeric Literals
- • Datetime Literals
- • Types of Expressions
- • Concatenation
- • Mathematical Expressions
- • Date and Time Arithmetic
- • Using Expressions in a SELECT Clause
- • Working with a Concatenation Expression
- • Naming the Expression
- • Working with a Mathematical Expression
- • Working with a Date Expression
- • A Brief Digression: Value Expressions
- • That “Nothing” Value: Null
- • Introducing Null
- • The Problem with Nulls
- • Sample Statements
- • Summary
- • Problems for You to Solve
Chapter 6: Filtering Your Data
- • Refining What You See Using WHERE
- • The WHERE Clause
- • Using a WHERE Clause
- • Defining Search Conditions
- • Comparison
- • Range
- • Set Membership
- • Pattern Match
- • Null
- • Excluding Rows with NOT
- • Using Multiple Conditions
- • Introducing AND and OR
- • Excluding Rows: Take Two
- • Order of Precedence
- • Checking for Overlapping Ranges
- • Nulls Revisited: A Cautionary Note
- • Expressing Conditions in Different Ways
- • Sample Statements
- • Summary
- • Problems for You to Solve
Chapter 7: Thinking in Sets
- • What Is a Set, Anyway?
- • Operations on Sets
- • Intersection
- • Intersection in Set Theory
- • Intersection between Result Sets
- • Problems You Can Solve with an Intersection
- • Difference
- • Difference in Set Theory
- • Difference between Result Sets
- • Problems You Can Solve with Difference
- • Union
- • Union in Set Theory
- • Combining Result Sets Using a Union
- • Problems You Can Solve with Union
- • SQL Set Operations
- • Classic Set Operations versus SQL
- • Finding Common Values: INTERSECT
- • Finding Missing Values: EXCEPT (DIFFERENCE)
- • Combining Sets: UNION
- • Summary
Chapter 8: INNER JOINs
- • What Is a JOIN?
- • The INNER JOIN
- • What’s “Legal” to JOIN?
- • Column References
- • Syntax
- • Check Those Relationships!
- • Uses for INNER JOINs
- • Find Related Rows
- • Find Matching Values
- • Sample Statements
- • Two Tables
- • More Than Two Tables
- • Looking for Matching Values
- • Summary
- • Problems for You to Solve
Chapter 9: OUTER JOINs
- • What Is an OUTER JOIN?
- • The LEFT/RIGHT OUTER JOIN
- • Syntax
- • The FULL OUTER JOIN
- • FULL OUTER JOIN on Non-Key Values
- • UNION JOIN
- • Uses for OUTER JOINs
- • Find Missing Values
- • Find Partially Matched Information
- • Sample Statements
- • Summary
- • Problems for You to Solve
Chapter 10: UNIONs
- • What Is a UNION?
- • Writing Requests with UNION
- • Using Simple SELECT Statements
- • Combining Complex SELECT Statements
- • Using UNION More Than Once
- • Sorting a UNION
- • Uses for UNION
- • Sample Statements
- • Summary
- • Problems for You to Solve
Chapter 11: Subqueries
- • What Is a Subquery?
- • Row Subqueries
- • Table Subqueries
- • Scalar Subqueries
- • Subqueries as Column Expressions
- • Syntax
- • An Introduction to Aggregate Functions: COUNT and MAX
- • Subqueries as Filters
- • Special Predicate Keywords for Subqueries
- • Uses for Subqueries
- • Build Subqueries as Column Expressions
- • Use Subqueries as Filters
- • Sample Statements
- • Subqueries in Expressions
- • Subqueries in Filters
- • Summary
- • Problems for You to Solve
Chapter 12: Simple Totals
- • Aggregate Functions
- • Counting Rows and Values with COUNT
- • Computing a Total with SUM
- • Calculating a Mean Value with AVG
- • Finding the Largest Value with MAX
- • Finding the Smallest Value with MIN
- • Using More Than One Function
- • Using Aggregate Functions in Filters
- • Sample Statements
- • Summary
- • Problems for You to Solve
Chapter 13: Grouping Data
- • Why Group Data?
- • The GROUP BY Clause
- • Syntax
- • Mixing Columns and Expressions
- • Using GROUP BY in a Subquery in a WHERE Clause
- • Simulating a SELECT DISTINCT Statement
- • “Some Restrictions Apply”
- • Column Restrictions
- • Grouping on Expressions
- • Uses for GROUP BY
- • Sample Statements
- • Summary
- • Problems for You to Solve
Chapter 14: Filtering Grouped Data
- • A New Meaning for “Focus Groups”
- • Where You Filter Makes a Difference
- • Should You Filter in WHERE or in HAVING?
- • Avoiding the HAVING COUNT Trap
- • Uses for HAVING
- • Sample Statements
- • Summary
- • Problems for You to Solve
Chapter 15: Updating Sets of Data
- • What Is an UPDATE?
- • The UPDATE Statement
- • Using a Simple UPDATE Expression
- • A Brief Aside: Transactions
- • Updating Multiple Columns
- • Using a Subquery to Filter Rows
- • Some Database Systems Allow a JOIN in the UPDATE Clause
- • Using a Subquery UPDATE Expression
- • Uses for UPDATE
- • Sample Statements
- • Summary
- • Problems for You to Solve
Chapter 16: Inserting Sets of Data
- • What Is an INSERT?
- • The INSERT Statement
- • Inserting Values
- • Generating the Next Primary Key Value
- • Inserting Data by Using SELECT
- • Uses for INSERT
- • Sample Statements
- • Summary
- • Problems for You to Solve
Chapter 17: Deleting Sets of Data
- • What Is a DELETE?
- • The DELETE Statement
- • Deleting All Rows
- • Deleting Some Rows
- • Uses for DELETE
- • Sample Statements
- • Summary
- • Problems for You to Solve
Chapter 18: “NOT” and “AND” Problems
- • A Short Review of Sets
- • Sets with Multiple AND Criteria
- • Sets with Multiple NOT Criteria
- • Sets Including Some Criteria but Excluding Others
- • Finding Out the “Not” Case
- • Using OUTER JOIN
- • Using NOT IN
- • Using NOT EXISTS
- • Using GROUP BY/HAVING
- • Finding Multiple Matches in the Same Table
- • Using INNER JOIN
- • Using IN
- • Using EXISTS
- • Sample Statements
- • Summary
- • Problems for You to Solve
Chapter 19: Condition Testing
- • Conditional Expressions (CASE)
- • Why Use CASE?
- • Syntax
- • Solving Problems with CASE
- • Solving Problems with Simple CASE
- • Solving Problems with Searched CASE
- • Using CASE in a WHERE Clause
- • Sample Statements
- • Summary
- • Problems for You to Solve
Chapter 20: Using Unlinked Data and “Driver” Tables
- • What Is Unlinked Data?
- • Deciding When to Use a CROSS JOIN
- • Solving Problems with Unlinked Data
- • Solving Problems Using “Driver” Tables
- • Setting Up a Driver Table
- • Using a Driver Table
- • Sample Statements
- • Examples Using Unlinked Tables
- • Examples Using Driver Tables
- • Summary
- • Problems for You to Solve
Chapter 21: Performing Complex Calculations on Groups
- • Grouping in Sub-Groups
- • Extending the GROUP BY Clause
- • Syntax
- • Getting Totals in a Hierarchy Using Rollup
- • Calculating Totals on Combinations Using CUBE
- • Creating a Union of Totals with GROUPING SETS
- • Variations on Grouping Techniques
- • Sample Statements
- • Examples using ROLLUP
- • Examples using CUBE
- • Examples using GROUPING SETS
- • Summary
- • Problems for You to Solve
Chapter 22: Partitioning Data into Windows
- • What You Can Do With a “Window” into Your Data
- • Syntax
- • Calculating a Row Number
- • Ranking Data
- • Splitting Data into Quintiles
- • Using Windows with Aggregate Functions
- • Sample Statements
- • Examples Using ROW_NUMBER
- • Examples Using RANK, DENSE_RANK, and PERCENT_RANK
- • Examples Using NTILE
- • Examples Using Aggregate Functions
- • Summary
- • Problems for You to Solve
Chapter Appendix A: SQL Standard Diagrams
Chapter Appendix B: Schema for the Sample Databases
- • Sales Orders Example Database
- • Sales Orders Modify Database
- • Entertainment Agency Example Database
- • Entertainment Agency Modify Database
- • School Scheduling Example Database
- • School Scheduling Modify Database
- • Bowling League Example Database
- • Bowling League Modify Database
- • Recipes Database
- • “Driver” Tables
Chapter Appendix C: Date and Time Types, Operations, and Functions
- • IBM DB2
- • Microsoft Access
- • Microsoft SQL Server
- • MySQL
- • Oracle
- • PostgreSQL
Chapter Appendix D: Suggested Reading
- • Database Books
- • Books on SQL
Customer Reviews
0.0
0 reviews
No reviews yet. Be the first to review this book!
Write a Review
Reviewed by GradeFocus Editorial Team
▶Research Sources (12)
- eBook Details
- SQL Queries for Mere Mortals
- Books by John L. Viescas
- SQL Queries for Mere Mortals: Beginner to Advanced Course
- SQL Queries for Mere Mortals: Bellevue College
- SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in ...
- 9780134858333_Sample.pdf
- SQL Queries for Mere Mortals, 4th Edition
- How to Use SQL To Work With Data In A Relational Database Today. ...
- Sql Queries For Mere Mortals 4th Edition
- 1. Intro, Writing, and Ordering Queries. SQL for Mere Mortals
- SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL





