Cover of SQL by Mark Chen, featuring an abstract representation of relational database tables and query structure

Pages

164

Published

2016

SQL ✨ New

SQL

A practical single-volume reference covering SQL fundamentals through advanced queries

Build a solid SQL foundation and write confident queries against any relational database, from your first SELECT to complex multi-table joins and aggregations.

SQL by Mark Chen is a focused 164-page guide that takes you from the basics of relational databases through the queries and techniques you will use daily as a developer, analyst, or data professional. It covers core syntax, filtering, sorting, grouping, joining tables, and more advanced topics β€” all in plain language with clear examples you can run immediately against your own database.

About this book

Most SQL books either drown beginners in theory before showing a single query, or skip foundations entirely and assume you already know what a primary key is. This book does neither. Mark Chen introduces each concept at the moment you need it, building your understanding query by query so that nothing feels arbitrary.

You start with the structure of a relational database β€” tables, rows, columns, keys β€” and write your first SELECT within the first few pages. From there the book moves steadily through filtering with WHERE, sorting with ORDER BY, aggregating data with GROUP BY and HAVING, and combining tables with INNER, LEFT, and other JOIN types. By the time you reach the later chapters, you are writing subqueries, working with functions, and understanding how an index affects the queries you already know how to write.

The examples are short enough to type and understand in a single sitting, but realistic enough that you will recognise the problems they solve. Every technique is shown in the context of a concrete task: finding the top customers by revenue, detecting duplicate records, summarising sales by region, updating a batch of rows safely.

  • Core SELECT syntax and the order SQL evaluates a query
  • Filtering, sorting, and limiting result sets precisely
  • Aggregation functions: COUNT, SUM, AVG, MIN, MAX
  • INNER JOIN, LEFT JOIN, RIGHT JOIN, and CROSS JOIN explained side by side
  • Subqueries and derived tables for multi-step logic
  • INSERT, UPDATE, and DELETE with safety in mind
  • Indexes: what they are, when they help, and when they hurt

At 164 pages, the book respects your time. It does not pad chapters with lengthy history lessons or vendor-specific tangents. The syntax shown is standard SQL that maps cleanly to MySQL, PostgreSQL, SQLite, and SQL Server, so the knowledge transfers regardless of which database you end up working with.

Whether you are a developer who needs to stop relying on an ORM to understand what queries are actually running, an analyst who wants to pull your own data without waiting for engineering, or a student preparing for a role where SQL is listed as a requirement, this book gives you a reliable foundation you can build on.

🎯 What you'll learn

  • Read and write SELECT statements with confidence against any relational database
  • Filter, sort, and paginate result sets using WHERE, ORDER BY, and LIMIT
  • Aggregate data with GROUP BY, HAVING, COUNT, SUM, AVG, MIN, and MAX
  • Join multiple tables using INNER, LEFT, RIGHT, and CROSS JOIN
  • Write subqueries and derived tables to handle multi-step query logic
  • Insert, update, and delete rows safely with appropriate WHERE clauses
  • Understand how indexes work and how to use them to speed up slow queries

πŸ‘€ Who is this book for?

  • Beginners with no prior database experience who want to start writing real queries quickly
  • Analysts and business intelligence users who need to query data without depending on a developer
  • Backend developers who know their ORM but want to understand the SQL it generates
  • Students preparing for data-related roles where SQL is a listed requirement
  • Professionals switching into data engineering or data science who need SQL fundamentals fast

Table of contents

  1. 01

    Relational Databases and SQL Basics

    You learn what a relational database is, how tables, rows, columns, and keys relate to each other, and where SQL fits in. You write your first SELECT statement and see an immediate result.

  2. 02

    Filtering and Sorting Data

    You use WHERE to filter rows by one or more conditions and ORDER BY to sort results. You also learn comparison operators, BETWEEN, IN, LIKE, and IS NULL for precise filtering.

  3. 03

    Working with Functions

    You apply built-in SQL functions to transform and format data, including string functions, numeric functions, and date functions supported across major databases.

  4. 04

    Aggregating and Grouping Results

    You use COUNT, SUM, AVG, MIN, and MAX to summarise data, then control which groups appear in your results using GROUP BY and HAVING.

  5. 05

    Joining Tables

    You combine rows from multiple tables using INNER JOIN, LEFT JOIN, RIGHT JOIN, and CROSS JOIN, and you learn to read query results that span more than one table.

  6. 06

    Subqueries and Derived Tables

    You write subqueries inside SELECT, WHERE, and FROM clauses to break complex logic into manageable steps, and you use derived tables to treat a query result as a temporary table.

  7. 07

    Inserting, Updating, and Deleting Data

    You modify data safely using INSERT, UPDATE, and DELETE, with a focus on writing WHERE clauses that protect you from accidental bulk changes.

  8. 08

    Indexes and Query Performance

    You learn what an index is, how the database uses it to avoid full table scans, and when adding or removing an index is the right call for the queries you are writing.

Frequently asked questions

Do I need any prior programming or database experience to read this book?

No prior experience is required. The book starts from the basics of what a relational database is and builds from there. Comfort with basic computer use is all you need.

Which database system does the book use for its examples?

The syntax shown is standard SQL that works across MySQL, PostgreSQL, SQLite, and SQL Server. Minor dialect differences are noted where they matter, so the examples are broadly portable.

Is this book still relevant given it was published in 2016?

Core SQL syntax has not changed significantly since 2016. The fundamentals, join types, aggregation functions, and indexing concepts covered here remain accurate and applicable in any modern relational database.

Is this book suitable for someone who already knows basic SQL?

If you can already write a JOIN and understand GROUP BY, you will likely find the early chapters review material. The book is best suited to beginners and those solidifying their foundational knowledge.

Does the book include practice exercises or downloadable sample data?

The book focuses on clear worked examples within the text. Check the publisher's page or any companion materials listed in the book's introduction for additional resources.

You might also like

πŸ“¬ Weekly Newsletter

Stay ahead of the curve

Get the best programming tutorials, data analytics tips, and tool reviews delivered to your inbox every week.

No spam. Unsubscribe anytime.