New
T-SQL Fundamentals
A complete foundation in Transact-SQL for SQL Server and Azure SQL development
Pages
670
A Hands-On Guide to Data Manipulation in SQL
Learn to write accurate, readable SQL queries against any relational database β starting from zero and building to real-world complexity.
SQL Queries for Mere Mortals is a step-by-step guide for anyone who needs to retrieve and manipulate data but has never written a query before. Working through realistic sample databases, you build from simple SELECT statements to multi-table joins, subqueries, and aggregations β gaining the intuition to write SQL confidently, not just copy it from Stack Overflow.
Most SQL books assume you already think like a database. This one starts where you actually are: staring at a table full of data, knowing the answer is in there somewhere, and not yet sure how to ask for it.
SQL Queries for Mere Mortals walks you through the relational model in plain terms, then teaches you to write queries the way a working analyst or developer does β one clause at a time, with immediate feedback from real sample data. Author John Viescas has spent decades teaching SQL to people who do not have a computer-science background, and that experience shows in every explanation.
You start with single-table SELECT statements and filtering, then progress through sorting, grouping, and aggregate functions. From there the book covers inner and outer joins across multiple tables, subqueries, set operations, and the full range of modification statements: INSERT, UPDATE, and DELETE. Each concept is demonstrated against concrete sample databases β a bowling league, an entertainment agency, a school scheduling system β so you always have a meaningful context rather than abstract syntax.
By the time you finish, you will be able to:
The sample databases and exercises are compatible with all major relational databases, including MySQL, PostgreSQL, Microsoft SQL Server, and SQLite, so the skills transfer directly to whatever system you are working with. At 670 pages, this is the reference you return to when a new problem stumps you, not just the tutorial you read once and shelve.
If you have avoided SQL because it looked arcane, or if you have been writing queries by trial and error without really understanding why they work, this book closes that gap.
Understand what a relational database is, how tables and relationships work, and where SQL fits in. You set up the sample databases used throughout the book.
Write your first queries using SELECT and WHERE to retrieve specific rows from a single table. Learn comparison operators, pattern matching with LIKE, and NULL handling.
Control the order and volume of query output using ORDER BY and row-limiting clauses. Understand why sort order is never guaranteed without an explicit ORDER BY.
Summarize data with COUNT, SUM, AVG, MIN, and MAX. Use GROUP BY and HAVING to compute per-group statistics and filter groups after aggregation.
Retrieve data spread across two or more tables using INNER JOIN and the various forms of OUTER JOIN. Understand join conditions and how to avoid unintended Cartesian products.
Break complex questions into smaller steps using subqueries in WHERE, FROM, and SELECT clauses. Build derived tables and correlated subqueries for problems that a flat join cannot solve.
Combine result sets from multiple queries using UNION, INTERSECT, and EXCEPT. Learn when set operations are clearer than equivalent joins or subqueries.
Insert new rows, update existing values, and delete records using INSERT, UPDATE, and DELETE. Practice writing safe modification statements that target exactly the intended rows.
Understand how PRIMARY KEY, FOREIGN KEY, UNIQUE, and CHECK constraints protect your data. See how the database enforces rules that your queries must respect.
Solve a series of realistic, multi-step business questions using every technique from the book. Review common mistakes and build a checklist for writing and reviewing SQL in a real project.
No. The book assumes you know nothing about SQL or relational databases. It introduces every concept from scratch, including what a table and a relationship are, before writing a single query.
The examples are written in standard SQL and work with MySQL, PostgreSQL, Microsoft SQL Server, SQLite, and Microsoft Access. Sample databases are provided for the major platforms so you can follow along on whatever system you have.
It depends on how solid your fundamentals are. Chapters 1 through 4 may be review, but the join, subquery, and set-operation chapters cover edge cases and common errors that many intermediate users have never properly examined.
No. The focus is entirely on writing correct SELECT, INSERT, UPDATE, and DELETE statements. Topics like indexing strategy, stored procedures, and query optimization are outside its scope.
The book covers core ANSI SQL, which is stable across decades and supported by every major relational database in active use today. Vendor-specific syntax differences are noted where they matter.
Yes. Each chapter includes review questions and hands-on exercises tied to the sample databases, so you can verify your understanding before moving to the next topic.
New
A complete foundation in Transact-SQL for SQL Server and Azure SQL development
New
Problem-Solution Recipes for SQL Across Multiple Database Platforms
by Anthony Molinaro, Robert de Graaf
New