Ten hands-on questions you answer by writing real queries against a live database, one 15-minute clock, and a score broken down by skill area. No sign-up to start.
An example of the result you get: a score, your time, and each skill area marked.
What the test covers
SQL screens for analyst, data and backend roles draw on the same short list of skills. The test takes its ten questions from all six, picked at random each time.
Basics
Picking columns, filtering with several conditions, sorting, LIMIT, NULL handling and CASE. SELECT, WHERE, ORDER BY, CASE
The questions that keep coming back: the Nth highest salary, earns more than the manager, median, cohort retention. DENSE_RANK, self join, pivot with CASE
A request from a colleague on messy raw tables: mixed capitals and spaces, amounts stored as text, mixed date formats, duplicate accounts. TRIM, UPPER, REPLACE, CAST
These come from the same pool as the test. In the test you write the query in an editor, run it against the tables as often as you like, and it is checked on the data you see and again on a changed copy.
Q1Repeat buyers
Aggregation
Return the customer_id of every customer who placed more than two orders, whatever the status.
orders14 rows
id
customer_id
order_date
amount
status
101
1
2025-01-03
120
paid
102
1
2025-01-20
80.5
paid
103
2
2025-01-22
200
paid
104
3
2025-02-02
45
refunded
105
3
2025-02-15
310
paid
106
4
2025-02-18
150
pending
107
5
2025-03-01
60
paid
108
6
2025-03-09
95
paid
109
6
2025-03-30
130
paid
110
6
2025-04-11
75
paid
111
7
2025-04-12
210
paid
112
1
2025-04-25
40
paid
113
2
2025-05-06
180
refunded
114
3
2025-05-19
220
paid
Show the answer
QuerySELECT customer_id FROM orders GROUP BY customer_id HAVING COUNT(*) > 2
HAVING filters groups after aggregation; WHERE filters rows before it.
Return the dept_id, name and salary of the highest-paid employee in each department. If several employees share the top salary in a department, return all of them. Ignore employees without a department.
employees11 rows
id
name
dept_id
salary
hire_date
manager_id
1
Ava
2
130000
2019-03-15
NULL
2
Ben
2
105000
2020-07-01
1
3
Cleo
1
82000
2021-01-10
7
4
Dan
1
76000
2022-05-23
7
5
Eve
3
54000
2022-09-12
11
6
Finn
2
98000
2021-11-30
1
7
Gia
1
99000
2018-06-04
NULL
8
Hugo
3
61000
2020-02-18
NULL
9
Iris
4
88000
2019-10-07
NULL
10
Jack
4
72000
2023-04-17
9
11
Kai
NULL
50000
2024-01-08
8
Show the answer
QuerySELECT dept_id, name, salary FROM (SELECT dept_id, name, salary, RANK() OVER (PARTITION BY dept_id ORDER BY salary DESC) AS r FROM employees WHERE dept_id IS NOT NULL) WHERE r = 1
Top-N per group is a classic interview question: rank in a subquery or CTE, then filter on the rank.
Each question is worth one point. You get the point when your query returns the right rows on the tables shown and again on a changed copy with extra rows and updated values, so an answer typed in as a fixed value does not score.
Row order is checked only when the question asks for an order, and column names do not matter. You can run and check a query as often as you like while the clock runs. A question you skip, or have not solved when the 15 minutes end, counts as wrong.
The result shows your score out of 10, the time you took, and each skill area as strong or to review, with links to the exercises for the areas you missed.
What your score means
0
1
2
3
4
5
6
7
8
9
10
0 to 4Build the basics first
Start with the first levels and work up. Short daily practice moves this score quickly.
5 to 7Working knowledge
The core is there. The areas you missed are the ones to drill before a timed screen.
8 to 10Interview-ready on this set
You solved questions from nearly every level under the clock. Drill the one or two areas you missed and you are in good shape.
These bands describe this test only. Employers set their own pass marks, and we do not know them.
Take the test
10 questions from 6 skill areas, 15 minutes on the clock. It starts right here, with no account and no email.
Hints and solutions are off while the clock runs.
Run and check a query as often as you like. Skip counts as wrong.
Your answers survive a page reload.
The mistakes that cost the most points
The checker on Querydrill names these when it sees them. Fix them before a timed test.
WHERE where HAVING belongs. A condition on COUNT or SUM filters groups, so it goes in HAVING, after GROUP BY. WHERE runs before the rows are grouped.
An inner join that drops rows. Customers with no orders vanish from an inner join. LEFT JOIN keeps them, and COALESCE turns the missing total into 0.
A join that repeats rows. Joining orders to their items before summing the order amount counts each order once per item. Aggregate first, or count with DISTINCT.
Integer division. In PostgreSQL 7 / 2 is 3. Multiply by 1.0 before dividing when the question asks for a share or an average.
Values typed into the query. Filtering on the id you can see in the sample rows is right today and wrong when the data changes, which is why every answer here is checked on a second copy of the data.
LIMIT without ORDER BY. The top three of an unsorted result is an arbitrary three. Sort first, and add DESC for largest first.
The three formats a SQL test comes in
Multiple choice about SQL knowledge: what a LEFT JOIN returns, where HAVING goes, what NULL = NULL evaluates to.
Live queries against a database, usually timed: read the tables, write the query, return the right rows. This test is that format, because knowing a clause and writing it under a clock are different skills.
A take-home case: raw tables and a list of business questions. Accuracy matters more than speed, and cleaning the data is tested as much as the queries.
Questions
Is the SQL practice test really free?
Yes. The test is free and you do not need a card. Free visitors get one attempt a day; Pro members can retake it any time.
Do I need an account or a database installed?
No to both. The test starts in one click and runs on PostgreSQL inside your browser, with the tables already loaded. Most questions use standard SQL, including window functions and CTEs; a few date questions use PostgreSQL's date functions such as to_char.
How long does the test take?
Up to 15 minutes. There are 10 questions on one clock, and the test ends when you finish the last question or the time runs out.
How is the test scored?
One point per question, 10 in total. A query scores when it returns the right rows on the tables shown and again on a changed copy of the data. Skipped or unsolved questions count as wrong. You also get a breakdown by skill area.
Is it like the SQL test employers use?
It uses the hands-on format: you write real queries against tables under a clock, which is how live SQL screens and online assessments work. It is not a copy of any employer's or testing company's test, and it does not include multiple-choice questions, schema design or query tuning.
Can I retake the test?
Yes. The questions are drawn at random from the exercise pool, so a retake is a different test. Free visitors can retake it the next day; Pro removes the limit.
What comes after the test?
Your result links straight to the exercises for the areas you missed. Your first 8 exercises on Querydrill are free without an account, and questions you solve in the test count toward them. Pro unlocks all 161 exercises, every reference solution, timed mode and the certificate.
Find out where you stand
Ten questions, 15 minutes, a score by skill area. Free, and no sign-up to start.