Stage 2 · Lesson 1 of 11
Queries and joins
Start by reading data from tables that already exist. SELECT picks the columns, WHERE filters the rows, ORDER BY sorts them and LIMIT caps how many come back. Then learn , which combine tables by matching their keys.
An INNER JOIN keeps only rows that have a match on both sides. A LEFT JOIN keeps every row from the left table, and fills in where there is no match. "Customers with their orders" is an inner join.
"Customers who have never ordered" is a left join, filtered with WHERE o.id IS NULL. Practise on with a real dataset.
Common trapNULL, which means "unknown": comparing anything with NULL gives unknown rather than true or false, so WHERE discount <> 10 silently skips rows where discount is NULL.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking Relational Database Design and Modeling
Design Gurus · Intermediate · $98 one-time
The modelling and normalisation decisions that stay with a codebase for years
- CourseFreeCS50's Introduction to Databases with SQL
Harvard University · Beginner
Free course from querying through schema design, indexes, transactions and scaling
Practise
Keep handy
Also worth your time
- Database Indexing Explained: B-Tree, Hash, Bitmap, R-Tree, and When to Use Each (opens in a new tab)Read
B-tree and composite indexes, plus the leftmost-prefix rule that trips people up
What sits under your queries: storage engines, transactions and isolation levels