SQL Beginner Quiz
SELECT, WHERE, JOIN and GROUP BY — the everyday clauses, checked by reading real queries.
Start the quizSample questions from this quiz
A preview of the style and depth. Try each one, then reveal the answer — or skip straight to the timed quiz.
1. The users table has 10 rows. What does this return?
SELECT COUNT(*) FROM users;- 10 rows
- One row containing 10
- One row containing 1
- An error — COUNT needs a column
Show answer
Answer: One row containing 10. An aggregate with no GROUP BY collapses the whole table into a single row. `COUNT(*)` counts rows; `COUNT(column)` counts only rows where that column is not NULL, which is a distinction worth internalising early.
2. What does this return?
SELECT name FROM users WHERE age > 18 ORDER BY name;- Names of users older than 18, sorted alphabetically
- All names, sorted by age
- Names of users aged 18 or older
- The single oldest user's name
Show answer
Answer: Names of users older than 18, sorted alphabetically. WHERE filters rows before they are returned, and ORDER BY sorts the result. Note `> 18` excludes exactly 18 — use `>=` to include it. Sorting is ascending by default; add DESC to reverse it.
3. Fill in the blank to keep only distinct values.
SELECT ____ country FROM users;- DISTINCT
- UNIQUE
- ONLY
- SINGLE
Show answer
Answer: DISTINCT. DISTINCT removes duplicate rows from the result. UNIQUE exists in SQL but as a table constraint, not a SELECT modifier. With several columns, DISTINCT deduplicates the whole combination rather than each column separately.
Frequently asked questions
How many questions are in this SQL quiz?+
30 questions, with a 30-minute time limit. Every question includes a written explanation of the correct answer.
Is this SQL quiz free?+
Yes. Every quiz on CodexQuizz is free and needs no account. You only enter a name if you choose to post your score to the leaderboard.
What level is the beginner quiz aimed at?+
SELECT, WHERE, JOIN and GROUP BY — the everyday clauses, checked by reading real queries.
Can I use this to prepare for a SQL interview?+
Yes. The questions cover the topics that come up in SQL technical screens, and the explanations are written so that a wrong answer still teaches you the underlying concept.
Ready to test your SQL?
30 questions, 30 minutes. Free, no sign-up.
Start now