


Prepare for the SQL round of your next job interview with 300 original job interview questions, each with a detailed explanation.
SQL is the first technical filter in interviews for data analyst, data scientist, data engineer, backend developer, BI developer, QA automation, database administrator and full-stack roles. Recruiters and hiring managers ask SQL questions because they are a fast, reliable way to see whether a candidate can really work with data. Most candidates know the basic SELECT statement. What separates those who get the offer from those who do not is the next layer: choosing the right join, avoiding the NULL traps, writing a correct GROUP BY and HAVING, using window functions without mistakes, understanding indexes and transactions, and spotting the bug in someone else's query.
This course is built around exactly that layer. It contains 6 full-length SQL practice tests with 50 questions each (300 questions in total), all at medium and hard level. There are no trivial questions that waste your time. Every question is written from scratch, and every answer comes with a step-by-step explanation that shows how the database actually evaluates the query, why the right answer is right, and why each wrong option fails.
Why this course is different
Every query is checked, not guessed. The correct answer to each query question was confirmed by running the SQL on a real database engine (PostgreSQL), and the course points out where MySQL behaves differently, so you do not learn habits that break when you change database.
Detailed explanations, not one-line answer keys. Each explanation walks through the evaluation step by step: what the join produces, what WHERE removes, what the window frame includes, and which trap the wrong options fall into.
Medium and hard only. The goal is to prepare you for real interview rounds, where the easy questions are already assumed.
The same small datasets are reused, with the data shown in the question. You spend your time thinking about the SQL, not hunting for a schema.
Interview-style question types. You will pick the correct query for a requirement, predict the exact output, find the bug in a broken query, choose the better design, and answer tricky concept questions that interviewers love.
Original content. The questions are not copied from any interview site, book or exam.
What the 6 practice tests cover
Practice Test 1: SQL Fundamentals (50 questions). SELECT and expressions, WHERE with AND, OR, IN, BETWEEN and LIKE, NULL handling and three-valued logic, ORDER BY, LIMIT and DISTINCT, aggregate functions, INSERT, UPDATE and DELETE, DDL and data types, and the built-in string, date and numeric functions that appear in screening rounds.
Practice Test 2: Joins and Set Operations (50 questions). INNER, LEFT, RIGHT, FULL and CROSS joins, self joins, multi-table joins, UNION, UNION ALL, INTERSECT and EXCEPT, the classic join pitfalls (duplicated rows, ON versus WHERE, NULL join keys), and anti-join and semi-join patterns.
Practice Test 3: Aggregation and Subqueries (50 questions). GROUP BY, HAVING versus WHERE, COUNT variants and conditional aggregation with CASE, scalar subqueries, IN, EXISTS and NOT EXISTS, correlated subqueries, derived tables, and the logical order of query execution.
Practice Test 4: CTEs and Window Functions (50 questions). Common table expressions, recursive CTEs for hierarchies, ROW_NUMBER, RANK and DENSE_RANK, LAG and LEAD, running totals and frame clauses (ROWS versus RANGE), NTILE, FIRST_VALUE and LAST_VALUE, top-N per group, gaps and islands, de-duplication, and advanced CASE, COALESCE and NULLIF.
Practice Test 5: Design, Indexes, Transactions and Performance (50 questions). Primary, foreign and unique keys and constraints, normalization from 1NF to 3NF, how indexes work and when they are ignored, ACID and isolation levels, deadlocks and locking, views, stored procedures and triggers, EXPLAIN and query tuning, SQL injection and least-privilege permissions, and MySQL versus PostgreSQL syntax differences.
Practice Test 6: Full Mock Interview (50 questions). A mixed, hard test that imitates a real interview loop: 15 write-the-query scenarios, 10 output-prediction questions, 10 find-the-bug questions, 8 optimization and design scenarios, and 7 tricky conceptual questions.
What you will learn
Choose the right join type and predict exactly how many rows it returns
Handle NULL correctly in comparisons, joins, aggregates, NOT IN and CHECK constraints
Write correct GROUP BY, HAVING and conditional aggregation queries
Use subqueries, EXISTS and correlated subqueries with confidence
Solve top-N per group, running total, ranking and gaps-and-islands problems with window functions
Write and trace recursive CTEs for hierarchies and sequences
Explain how indexes are used and why a query ignores them
Explain ACID, isolation levels, dirty reads, deadlocks and lost updates
Read basic EXPLAIN output and make a slow query faster
Spot and fix common bugs, from missing WHERE clauses to AND/OR precedence mistakes
Prevent SQL injection and apply least-privilege permissions
Recognise MySQL and PostgreSQL differences in LIMIT, string concatenation, date arithmetic, case sensitivity and upserts
How the practice tests work
Each test is timed, and each question has an explanation that appears when you review your results. Take a test, review every explanation (including the ones for questions you answered correctly), note the topics that cost you marks, and retake the test after a few days. Tests 1 to 5 are organized by topic, so you can target your weak areas. Test 6 is the final dress rehearsal and mixes everything, so take it last, under exam conditions.
Who this course is for
Job seekers preparing for data analyst, business analyst, data engineer, data scientist, BI, backend, full-stack and QA interviews
Students and fresh graduates who know basic SQL and want interview-level practice
Working developers and analysts who want to find gaps in their SQL before a technical round
Professionals switching careers into data and database roles
Anyone who uses MySQL or PostgreSQL and wants to move confidently between them
Requirements
Basic familiarity with SQL (you have written a few SELECT queries)
No software is needed. All questions show the data and the query in the question itself
Optional: a free MySQL or PostgreSQL installation if you want to experiment with the queries yourself
Start with Practice Test 1 to find your level, work through Tests 2 to 5 to close your gaps, and finish with the Full Mock Interview in Test 6.