The SQL Checklist for Data Science
Use this interactive page to practice all the SQL you need for data science.
Each concept is a flash card. Say or write out each concept, then click on the item to reveal the answer. Check the box when you know it and feel confident. See Part 1 and Part 2 for more information on each item.
Selecting & Filtering
Selecting, filtering, and ordering rows are the most basic operations. See Part 1 for full explanations.
Basic select, limit +
Ordering — asc/desc, multi-column +
Filtering with where +
In / not in +
Is null +
Joins
Joins combine rows from two tables based on matching columns. It’s one of the most powerful features of the language. See Part 1 for the full explanation, including anti, self, cross, and range joins.
Basic join, table aliasing +
Join types & unmatched rows +
Anti join +
Self join +
Cross join +
Range join +
Grouping & Aggregating
Aggregating functions allow you to summarize many rows. Grouping allows you to perform the same operation for many subunits. See Part 1 for the full explanations.
Group by, count/sum/avg/min/max +
Distinct inside aggregates +
Median +
Handling nulls in aggregates +
Organizing Complex Queries
CTEs and intermediate tables are a must for keeping complex, multi-step queries readable and re-runnable. See Part 2 for the full explanations.
CTEs +
Intermediate tables +
Window Functions
Window functions let you calculate a value across multiple rows without collapsing them, like a running total or the top row per group. See Part 2 for the full explanations.
Over, partition by, order by +
Top row per group +
Dates, Strings & New Columns
Working with dates, strings, and conditional logic to shape and categorize your data. See Part 2 for the full explanations.
Date truncation +
Date arithmetic +
String concatenation +
Pattern matching +
Case when +
Sampling, Reshaping & Utilities
Sampling large data for fast iteration, reshaping arrays, and finding your way around unfamiliar tables. See Part 2 for the full explanations.