Loved the from-first-principles approach. It rebuilt my intuition rather than just handing me formulas.

SQL Masterclass
From SELECT to window functions, then into Python and R.
A hands-on path from installing PostgreSQL to writing joins, window functions, and CTEs against a real DVD-rental database. Then connect SQL to Python and R, ship a capstone library app, and prep for interviews.
Read on your Kindle or e-reader
Download the EPUB and read offline — perfect for the train. Works on Kindle, Kobo, Apple Books & more.
00Getting Started4 capsules
Getting Started — 4 chapters.
01Why SQL Still Runs the Worldintuitionfree11 min02What Is SQL? Declarative Queries vs Imperative Codeconceptfree11 min03Installing PostgreSQL and pgAdmin 4code🔒12 min04Loading the DVD Rental Sample Databasecode🔒10 min01Database Foundations5 capsules
Database Foundations — 5 chapters.
05What Is a Database? Core Terminologyconcept🔒11 min06The Relational Model: Tables, Primary Keys, Foreign Keysconcept🔒12 min07Relational vs NoSQL: Two Ways to Store Dataintuition🔒11 min08ACID vs BASE: Guarantees a Database Makesdeep-dive🔒11 min09Data Types and Schema Designconcept🔒11 min02Basic SQL Commands7 capsules
Basic SQL Commands — 7 chapters.
10CREATE TABLE: Defining Your First Tablecode🔒12 min11INSERT: Putting Data Into Tablescode🔒11 min12SELECT: Reading Datacode🔒11 min13Filtering Rows with WHEREcode🔒12 min14Sorting and Limiting: ORDER BY and LIMITcode🔒9 min15UPDATE and DELETE: Changing Data Safelycode🔒11 min16Aggregation: COUNT, SUM, GROUP BY, and HAVINGcode🔒12 min03Advanced SQL: Joins and Window Functions6 capsules
Advanced SQL: Joins and Window Functions — 6 chapters.
17Joins, Intuitively: Combining Tablesintuition🔒10 min18INNER, LEFT, RIGHT, and FULL OUTER JOINcode🔒11 min19Window Functions: RANK vs DENSE_RANKdeep-dive🔒9 min20OVER and PARTITION BY: The Window Frameconcept🔒11 min21Pattern Matching with LIKE and Wildcardscode🔒11 min22Subqueries and CTEs (WITH)code🔒11 min04Solving Advanced SQL Problems4 capsules
Solving Advanced SQL Problems — 4 chapters.
23A Framework for Hard Queriesintuition🔒11 min24Worked Problem: Replace Employee ID with Its Identifierproject🔒11 min25Worked Problem: Product Sales Analysisproject🔒12 min26Worked Problem: Rank Scoresproject🔒10 min05SQL with Python and R5 capsules
SQL with Python and R — 5 chapters.
27Connecting Python to PostgreSQL with psycopg2code🔒12 min28From Query to DataFrame: Analyzing in Pandascode🔒11 min29Visualizing SQL Data in Pythonproject🔒10 min30Connecting R to PostgreSQL with DBI and RPostgrescode🔒10 min31Visualizing SQL Data in R with ggplot2project🔒11 min06Capstone and Interview Prep5 capsules
Capstone and Interview Prep — 5 chapters.
32Capstone: Designing the Library Databaseproject🔒11 min33Capstone: CRUD Operations from Pythonproject🔒12 min34Query Optimization and Indexesdeep-dive🔒11 min35SQL Interview Tips and Tricksintuition🔒12 min36Putting It All Togetherconcept🔒13 minRatings & reviews
1,399 readersBeautifully produced and genuinely deep. The reader experience makes it easy to keep going for hours.
Concise capsules I can finish over coffee, yet each one taught me something I actually use.
Rare mix of depth and readability. The worked examples are the clearest I have seen on this subject.
The hand-drawn diagrams make abstract ideas click instantly. Wish every technical book was written like this.