Skip to content
Maestro

SQL for Data People: Think in Tables, Not Spreadsheets

By the end, you'll be able to read, write and debug multi-step SQL queries that filter, join and summarize real data, and explain what each part does in the right terms.

You go at your own pace, with your Maestro beside you, 1:1, through the whole course. Open it from the page you're on and ask it anything; it asks you questions too.

59 skills · 7 modules

Flash sale

$5

Back to $25 on October 14.

Comes with your Maestro, 1:1, for the whole course.

What you'll be able to do

Each box is a skill. The base is at the bottom, recognizing and explaining, and you work your way up to building something of your own and judging what works and why.

  1. Evaluate

    • Choose whether a step belongs in SQL or in Python, R or Excel, and justify the choice

      Where I teach it: Creating and changing data · SQL, or Python, R or Excel?

      Builds on:

      • Explain that SQL is declarative: you describe the result you want and the DBMS decides how to get it
      • Explain how a database table differs from a DataFrame: it lives in the database, not in your session's memory
      • Summarize per group with GROUP BY
      • Combine two tables with INNER JOIN on a key

      Your Maestro asks you to judge when it fits and why and saves it as evidence when you do.

  2. Synthesize

    • Design a multi-step query with CTEs that filters, joins and summarizes to answer a question

      Where I teach it: Building bigger queries · Capstone: a multi-step query

      Builds on:

      • Break a query into named steps with WITH (common table expressions)
      • Join three or more tables in one query by following the schema's keys
      • Filter groups by an aggregate with HAVING

      Your Maestro asks you to build something of your own with it and saves it as evidence when you do.

  3. Analyze

    • Trace the logical order in which a query's clauses run (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY, LIMIT) to predict what each clause can see

      Where I teach it: Asking one table questions · The order clauses really run in

      Builds on:

      • Filter rows with WHERE using comparison operators
      • Sort results with ORDER BY on one or more columns, ascending or descending
      • Compute new columns with expressions and rename result columns with AS
      • Explain that SQL is declarative: you describe the result you want and the DBMS decides how to get it

      Your Maestro asks you to break a problem down with it and saves it as evidence when you do.

    • Diagnose a failing query from its error message (unknown column, syntax error, alias used too early)

      Where I teach it: Asking one table questions · Reading error messages

      Builds on:

      • Trace the logical order in which a query's clauses run (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY, LIMIT) to predict what each clause can see

      Your Maestro asks you to break a problem down with it and saves it as evidence when you do.

    • Diagnose a GROUP BY error caused by a selected column that is neither grouped nor aggregated

      Where I teach it: Summarizing · GROUP BY: one summary row per group

      Builds on:

      • Summarize per group with GROUP BY
      • Trace the logical order in which a query's clauses run (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY, LIMIT) to predict what each clause can see

      Your Maestro asks you to break a problem down with it and saves it as evidence when you do.

    • Decide whether a filter belongs in WHERE or HAVING based on when each runs

      Where I teach it: Summarizing · HAVING vs. WHERE

      Builds on:

      • Filter groups by an aggregate with HAVING
      • Trace the logical order in which a query's clauses run (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY, LIMIT) to predict what each clause can see

      Your Maestro asks you to break a problem down with it and saves it as evidence when you do.

    • Diagnose inflated totals caused by joining a one-to-many table before aggregating

      Where I teach it: Combining tables · Predicting row counts, and totals that grow

      Builds on:

      • Predict how a join changes the row count with one-to-one, one-to-many and many-to-many relationships
      • Summarize per group with GROUP BY

      Your Maestro asks you to break a problem down with it and saves it as evidence when you do.

    • Predict how a join changes the row count with one-to-one, one-to-many and many-to-many relationships

      Where I teach it: Combining tables · Predicting row counts, and totals that grow

      Builds on:

      • Combine two tables with INNER JOIN on a key
      • Explain what a primary key is: the column or columns whose values uniquely identify each row and are never NULL

      Your Maestro asks you to break a problem down with it and saves it as evidence when you do.

  4. Apply

    • Run a query from a SQL client and read the result set it shows

      Where I teach it: Your first query · Connect and run your first query

      Builds on:

      • Distinguish the database, the DBMS (engine) that manages it, and the client tool used to talk to it
      • Explain what a database connection is and what connection details (host, database, user, credentials) specify
      • Explain what a query is: a statement sent to the DBMS that asks for data and gets back a result

      Your Maestro asks you to use it on a new case and saves it as evidence when you do.

    • Write a SELECT that returns chosen columns from a table

      Where I teach it: Your first query · SELECT the columns you want

      Builds on:

      • Run a query from a SQL client and read the result set it shows
      • Name the parts of a table: table, row (record), column (field) and value

      Your Maestro asks you to use it on a new case and saves it as evidence when you do.

    • Compute new columns with expressions and rename result columns with AS

      Where I teach it: What's really in a table · Computed columns and AS

      Builds on:

      • Write a SELECT that returns chosen columns from a table
      • Explain why each column has one data type and recognize common SQL types (integer, decimal, text, date, boolean)

      Your Maestro asks you to use it on a new case and saves it as evidence when you do.

    • Reference a table by its qualified name (schema.table) to say exactly which table you mean

      Where I teach it: What's really in a table · Schemas: the word with two meanings

      Builds on:

      • Explain the two meanings of schema: a table's structure and a namespace that groups tables

      Your Maestro asks you to use it on a new case and saves it as evidence when you do.

    • Use a schema diagram (ERD) to identify tables, their keys and how the tables relate

      Where I teach it: What's really in a table · Reading a schema diagram

      Builds on:

      • Explain what a primary key is: the column or columns whose values uniquely identify each row and are never NULL
      • Explain what a foreign key is and how it relates rows in one table to rows in another

      Your Maestro asks you to use it on a new case and saves it as evidence when you do.

    • Filter rows with WHERE using comparison operators

      Where I teach it: Asking one table questions · WHERE: keep only the rows you want

      Builds on:

      • Write a SELECT that returns chosen columns from a table

      Your Maestro asks you to use it on a new case and saves it as evidence when you do.

  5. Understand

    • Distinguish the database, the DBMS (engine) that manages it, and the client tool used to talk to it

      Where I teach it: Your first query · Database, DBMS, client: three things people call "the database"

      Builds on:

      • Define a relational database as an organized collection of related tables managed by software

      Your Maestro asks you to explain it in your own words and saves it as evidence when you do.

    • Explain how a database table differs from a spreadsheet: no row order, one type per column, no cell addresses

      Where I teach it: Your first query · Tables aren't spreadsheets

      Builds on:

      • Name the parts of a table: table, row (record), column (field) and value

      Your Maestro asks you to explain it in your own words and saves it as evidence when you do.

    • Explain how a database table differs from a DataFrame: it lives in the database, not in your session's memory

      Where I teach it: Your first query · Tables aren't DataFrames either

      Builds on:

      • Name the parts of a table: table, row (record), column (field) and value

      Your Maestro asks you to explain it in your own words and saves it as evidence when you do.

    • Explain that a SELECT returns a result set that is shown, not stored or assigned to a variable, unless you save it

      Where I teach it: Your first query · What a query is, and why nothing gets saved

      Builds on:

      • Explain what a query is: a statement sent to the DBMS that asks for data and gets back a result
      • Explain how a database table differs from a DataFrame: it lives in the database, not in your session's memory

      Your Maestro asks you to explain it in your own words and saves it as evidence when you do.

    • Explain what a query is: a statement sent to the DBMS that asks for data and gets back a result

      Where I teach it: Your first query · What a query is, and why nothing gets saved

      Builds on:

      • Define a relational database as an organized collection of related tables managed by software

      Your Maestro asks you to explain it in your own words and saves it as evidence when you do.

    • Explain what a database connection is and what connection details (host, database, user, credentials) specify

      Where I teach it: Your first query · Connect and run your first query

      Builds on:

      • Distinguish the database, the DBMS (engine) that manages it, and the client tool used to talk to it

      Your Maestro asks you to explain it in your own words and saves it as evidence when you do.

  6. Remember

    • Define a relational database as an organized collection of related tables managed by software

      Where I teach it: Your first query · Database, DBMS, client: three things people call "the database"

      Your Maestro asks you to recognize and recall it and saves it as evidence when you do.

    • Name the parts of a table: table, row (record), column (field) and value

      Where I teach it: Your first query · Tables aren't spreadsheets

      Builds on:

      • Define a relational database as an organized collection of related tables managed by software

      Your Maestro asks you to recognize and recall it and saves it as evidence when you do.

What we'll cover

  1. Your first query

    1. Welcome: SQL for people who already work with datareference
    2. Database, DBMS, client: three things people call "the database"
    3. Tables aren't spreadsheets
    4. Tables aren't DataFrames either
    5. What a query is, and why nothing gets saved
    6. Connect and run your first query
    7. SELECT the columns you want
  2. What's really in a table

    1. Types, and the value that isn't there: NULL
    2. Computed columns and AS
    3. Schemas: the word with two meanings
    4. Primary keys and foreign keys
    5. Reading a schema diagram
    6. Reading vs. writing, and why SQL is declarative
    7. Glossary: the words so farreference
  3. Asking one table questions

    1. WHERE: keep only the rows you want
    2. IN, BETWEEN and LIKE
    3. Filtering NULLs: IS NULL, not = NULL
    4. ORDER BY, LIMIT and DISTINCT
    5. The order clauses really run in
    6. Reading error messages
  4. Summarizing

    1. Aggregates, and the three kinds of COUNT
    2. How NULL changes an aggregate
    3. GROUP BY: one summary row per group
    4. HAVING vs. WHERE
    5. From pivot tables, dplyr and pandas to GROUP BY
  5. Combining tables

    1. How joins work (and why they aren't VLOOKUP)
    2. INNER JOIN and table aliases
    3. LEFT JOIN: keep every row on the left
    4. Predicting row counts, and totals that grow
    5. Joining three or more tables
  6. Building bigger queries

    1. CASE WHEN: conditional columns and conditional counts
    2. Subqueries: a query inside a query
    3. CTEs: name your steps with WITH
    4. Reading someone else's query
    5. Capstone: a multi-step query
  7. Creating and changing data

    1. CREATE TABLE and INSERT
    2. Keeping a result: tables and views
    3. UPDATE and DELETE, safely
    4. SQL, or Python, R or Excel?
    5. What's nextreference

Your Maestro knows this course

  • It always knows which page you're on.
  • It works from the skills I picked for this course, the ones on the map above.
  • Ask it how you're doing, and it tells you what you've already shown and what comes next.

What you get

  • 7 modules and 40 pages, open whenever you want them.
  • Your Maestro for the whole course, who knows every lesson and what you've already shown it. You open it from the page you're on.

Who's teaching you

Sergio Sánchez

I'm Sergio, chekos online. I've worked with data for about ten years, mostly at mission-driven organizations: policy research first, then education, and now early childhood services. In 2018 I started tacosdedatos to share what I was learning, and since then it's been a blog, a podcast, courses, guides, and a community. These days I spend a lot of my time building with AI agents and writing about how I organize my work around them. I share what I've learned; you take what's useful and make it yours.

See you in the course

SQL for Data People: Think in Tables, Not Spreadsheets

Flash sale

$5

Back to $25 on October 14.

Comes with your Maestro, 1:1, for the whole course.