Practice
SQL Practice
BasicHands-on SQL lessons - write real queries against a live in-browser database and get checked instantly.
Lessons
- Select specific columns
- Filter rows with WHERE
- Sort and limit results
- Count and summarize
- Group rows together
- Filter groups with HAVING
- Combine tables with JOIN
- Capstone: total spent per customer
- Subqueries: a query inside a query
- Rank rows with a window function
- Messy data: NULLs and duplicate names
- Transactions: all or nothing
- Capstone: rank customers, gaps included
- Many-to-many: joining through a junction table
- CTEs: naming a subquery with WITH
- CASE: bucket rows into categories
- UNION: combining two result sets
- ALTER TABLE: changing a table's shape
- Self-join: a table joined to itself
- Fix the bug: rows go missing, no error
- Fix the bug: NOT IN quietly returns nothing
- Fix the bug: a JOIN that doubles your revenue
- The status column everyone forgets
- One typo splits a group into three
- Capstone: define "top customer" before you query it
- Capstone: who has churned