Library · language

SQL

Ask precise questions of tables of data. The one skill that appears in almost every data job description, and in many software and AI ones too.

SQL is how you talk to relational databases and warehouses such as PostgreSQL, MySQL, SQL Server, BigQuery, Snowflake and DuckDB. The dialects differ in small ways; the ideas on this shelf work in all of them.

Every example here runs on real public data with DuckDB, a free database that needs no server and reads CSV and Parquet files straight from a URL.

  1. 1Selecting, filtering and aggregatingWhat is SQL? Databases, tables and your first query12 min read
  2. 2Selecting, filtering and aggregatingSQL SELECT, WHERE and ORDER BY on real taxi trips10 min read
  3. 3Selecting, filtering and aggregatingSQL NULL values: IS NULL, COALESCE and three-valued logic10 min read
  4. 4Selecting, filtering and aggregatingSQL data types and CAST: numbers, text, dates12 min read
  5. 5Selecting, filtering and aggregatingSQL LIKE, IN and BETWEEN with wildcards and ranges11 min read
  6. 6Selecting, filtering and aggregatingSQL CASE WHEN: conditional logic and buckets10 min read
  7. 7Selecting, filtering and aggregatingSQL GROUP BY, aggregate functions and HAVING10 min read
  8. 8Joins, subqueries and set operationsSQL INNER JOIN vs LEFT JOIN with real examples13 min read
  9. 9Joins, subqueries and set operationsSQL FULL OUTER JOIN, CROSS JOIN and SELF JOIN15 min read
  10. 10Joins, subqueries and set operationsSQL join fan-out: avoid double counting rows13 min read
  11. 11Joins, subqueries and set operationsSQL subqueries: IN, EXISTS and correlated subqueries12 min read
  12. +33 more beginner lessonsOpen the full list

SQL lessons

Loading lessons…

    Further reading

    • DuckDB documentation ↗docs · free

      The free, serverless database used in most SQL examples on UniMitra.

    • NYC TLC trip record data ↗dataset · free · NYC Open Data public data (TLC terms of use)

      Monthly Parquet files of every yellow and green taxi trip in New York City.

    • UCI Online Retail II ↗dataset · free · CC BY 4.0

      Two years of order lines from a UK online gift wholesaler, used across the data shelves.