Run SQL, build your query-writing skills.
Watch how it works, interact with a query, then solve the problem.
You can aim for: SQL (data manipulation & analysis)Try the SQL PlaygroundSELECT basics
Tables, Rows, Columns, and Keys
How data is laid out in a table, and what a primary key does.
SELECT and Projecting Columns
Choosing which columns the result contains.
Filtering Rows with WHERE
Keeping only the rows that match a condition.
Comparison and Logical Operators
Combining conditions with AND, OR, NOT, BETWEEN, IN, and LIKE.
NULL and Three-Valued Logic
Why = NULL never matches, and how AND/OR handle unknown.
ORDER BY and LIMIT / OFFSET
Sorting the result and paging through it.
DISTINCT
Removing duplicate rows from a result.
Joins
INNER JOIN
Connecting rows whose keys match.
Outer Joins
Keeping unmatched rows with NULLs.
Self Joins
Joining one table to itself through aliases.
CROSS JOIN and All Combinations
Producing every combination of two row sets.
Joining Three or More Tables
Chaining JOINs across several tables.
Join Algorithms
Comparing three ways to match rows.
Aggregation and grouping
Aggregate Functions
Fold many rows into one value.
GROUP BY
Separate rows into groups with the same value.
HAVING
Filter groups after aggregation.
SELECT Processing Order
Follow an aggregate query in logical processing order.
Window Functions
Calculate ranks and running totals while retaining rows.
Subqueries, CTEs, set operations
Scalar Subqueries
Use a single value returned by a subquery.
IN, EXISTS, and Correlated Subqueries
Test an inner result for each outer row.
Subqueries in FROM
Use a subquery result as a table.
CTEs and Recursive CTEs
Name an intermediate result and follow parent-child relationships step by step.
Set Operations
Combine two SELECT results vertically.