How to use the SQL MCQ Quiz
- 1. Pick the lengthChoose 10 SQL questions or all 21, with shuffle on or off.
- 2. Answer each questionTap an option to see at once if it is right, plus a short SQL explanation.
- 3. See your scoreFinish to get your SQL score and a review of all your answers.
What this quiz covers
SQL is the most asked skill in data analyst job posts and a regular part of developer interviews. This quiz covers:
- Filtering and sorting: WHERE, ORDER BY, LIKE patterns, BETWEEN and DISTINCT.
- NULL handling: IS NULL, COUNT(*) vs COUNT(col), COALESCE and NULL in arithmetic.
- Grouping: GROUP BY, HAVING vs WHERE and the order SQL processes clauses.
- Combining data: LEFT JOIN, self joins, UNION vs UNION ALL, IN with subqueries and CTEs.
- Classic questions: the second highest salary and window functions like ROW_NUMBER().
Worked example and how to use it
Example: How do you find rows where email is missing? The answer is WHERE email IS NULL. Writing WHERE email = NULL never matches anything, because NULL means "unknown" and comparing anything to unknown gives unknown, not true. The same rule explains why SELECT 5 + NULL returns NULL.
Another frequent one is the order SQL processes a query: FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY. That is why you cannot use a column alias from SELECT inside WHERE in most databases, but you can in ORDER BY.
Reading SQL is good; writing it is better. Try every query idea from this quiz on real tables in the SQL online compiler, and see joins visually in the SQL joins visualizer.
Frequently asked questions
Which SQL dialect does the quiz use?
Standard SQL that works in MySQL, PostgreSQL, SQL Server and SQLite.
Is it good for data analyst interviews?
Yes. NULL handling, GROUP BY with HAVING, joins and the second-highest-salary question are interview favourites.
Can I practise writing queries too?
Yes, with the free SQL online compiler, which has a ready sample database.
Is it free?
Yes, completely free. Your final score asks for your name and WhatsApp number once, and every Uncodemy tool after that opens without asking.