When I started learning SQL, I could write SELECT * FROM table and that was about it.
The problem wasn't understanding concepts — it was getting enough practice to make them stick. Reading tutorials gives you confidence. Writing 40 queries gives you competence.
Last month I scored 119/120 on a SQL capstone. Here's what I learned about practicing SQL effectively:
The Progressive Approach
Don't jump into window functions until you can write a basic JOIN without syntax errors. Here's the progression that worked for me:
Level 1: Basic Queries
Master SELECT, WHERE, ORDER BY, LIMIT. Sounds simple, but 80% of real-world queries are just these with more columns.
Level 2: Aggregation
GROUP BY is where SQL gets interesting. Add HAVING to filter your groups. Use CASE inside aggregations.
Level 3: Joins
INNER JOIN is your daily driver. LEFT JOIN catches everything else. SELF JOIN is weird but powerful once it clicks.
Level 4: Subqueries & CTEs
CTEs (WITH clauses) changed everything for me. Instead of nested subqueries that look like spaghetti, you get clean, readable steps.
Level 5: Window Functions
ROW_NUMBER, RANK, LAG, LEAD, running totals. These are what separate "I know SQL" from "I can write production queries."
Practice > Theory
I compiled 40 exercises following this exact progression into a workbook. Each exercise has:
- A self-contained dataset (CREATE TABLE + INSERT — no external files)
- Expected output written in comments
- A full answer key
If you want it: https://deepanshu647.gumroad.com/l/pkrci
Or if you just want the Level 1 exercises as a free sample, comment below and I'll paste them.
I'm Deepanshu — BTech IT, self-taught data scientist. I document everything I learn.
Top comments (0)