
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
A SQL interview usually goes wrong on the second question. The interviewer hands you an orders table and a customers table and asks for revenue per customer. Your join quietly doubles the totals. Or the answer is right, but the table has fifty million rows and you can't say why the query is slow. This course is built around those moments.
SQL Interview Questions: Coding Practice and Mock Rounds is a practice course, and you spend most of it writing queries. Each topic opens with three short lectures that explain the idea the way an analyst would explain it to a teammate. Then come about twenty coding exercises at four levels, easy to difficult, and each level ends with an AI role play where you answer out loud and get a debrief at the end. The course has 17 topic sections, then a final section of full mock rounds.
The lectures are named after the questions an interviewer would ask. In the joins section, for example, they are "What are the different types of Joins in SQL", "How do join conditions cause row fan-out and lost rows", and "How do anti, semi and self joins solve common analyst questions". Each one is a short answer you could give in the room.
Here is what the course covers, in the order you'll work through it:
Joins and join types, including how join conditions cause row fan-out and lost rows, and when to reach for anti joins, semi joins and self joins
Aggregations, GROUP BY and HAVING, subqueries and correlated subqueries
NULL handling and set-based thinking, which is where a lot of quietly wrong answers come from
Ranking window functions, then LAG, LEAD and window frames
Sessionization and gaps and islands problems
CTE patterns and recursive queries
Rewriting slow queries, reading indexes and execution plans, partitioning and statistics
Retention queries, funnel conversion queries, cohort tables and rolling metrics
Experiment assignment and A/B test queries, metric definitions and guardrail metrics
Full mock rounds that pull everything together
The SQL interview courses I looked at before writing this one don't cover retention, funnels or A/B tests. Those are the questions data analyst and analytics engineer interviews lean on, because they look like real work. You'll build a weekly cohort table, calculate step-to-step funnel drop-off, work out who was actually in an experiment and for how long, and define a metric so that two people reading the query get the same number.
A query that returns the right rows but times out still fails the job, so there's a full block on performance. You'll read an execution plan and say what the database is doing, spot the filter that stops an index from being used, and rewrite a slow query without changing its result.
The early topics catch people too. A stray HAVING condition, a correlated subquery that runs once per row, and a NOT IN that returns nothing because of a single NULL all turn up in interviews. You'll hit each one on purpose, see what the database does, and learn the fix. That's why there's a full section on NULL handling and set-based thinking. Once you think in sets instead of loops, window functions, CTEs and gaps and islands problems start to look like one idea used in different places.
The early coding exercises check that the idea has landed, like listing orders with customer names or finding customers who never ordered. The later ones are written the way interviewers write them: an ambiguous business question, a messy table and a trap. One asks how many rows a left join will return before you run it. Another gives you a revenue report inflated by fan-out and asks you to fix it. You'll get some wrong. Each exercise gives you something concrete to check against, so a wrong query shows up as a wrong result and not as a vague feeling that something is off.
The role plays are where you rehearse the conversation. You explain your approach, handle a follow-up question, and get a debrief on what was strong and what was thin. They don't replace a human mock interview, but you can rehearse a hard topic ten times without finding someone with a free hour.
In a real interview nobody tells you which topic a question belongs to. The last section is four full mock rounds that pull the topics together, so you practice working that out.
By the time you reach the full mock rounds, you'll have written several hundred queries and have a routine for any new question: restate it, check the grain of the table, write it in small steps, and test it on a few rows before you trust it.
If you're short on time, start with the topics you'd dread most, do the easy exercises, and run the first role play to see where you're thin. If you have more time, work through the sections in order. Later topics lean on earlier ones: window functions lean on grouping, and cohort tables lean on both.
This fits you if you're preparing for data analyst, business analyst, analytics engineer or data scientist interviews and already know basic SELECT statements. It also works if you use SQL daily at work but haven't done timed interview questions in a while. It isn't a first SQL course. If you've never written a query, start with a beginner course and come back once SELECT, WHERE and ORDER BY feel familiar.
You need a web browser and basic comfort reading a table. The coding exercises run inside the course, so there's nothing to install.
I'm KD. I've worked with data for more than 13 years, and I teach data analytics and AI courses online. I also run an education company in India that helps freshers get job-ready through job simulations. I wrote this course because the same few SQL mistakes show up again and again, and they are much cheaper to make here than in front of an interviewer.
Try the preview lectures first and see whether the pace and style suit you.