SQL level test: 8 questions to help you choose where to start
Answer eight situations ordered by prerequisite. The recommendation starts at the first foundation you need to strengthen, not from an overall score.
What it measures and what it does not
The test checks whether you can interpret common decisions along the path: where rows come from, filters, missing values, grouping, relationships, subqueries, safe changes and window functions.
- There is no time limit and no locked content.
- A correct answer shows recognition and initial reasoning, not practical mastery.
- The recommendation puts the first missing prerequisite first, even if you get later questions right.
- To confirm your level, you will then need to solve a query without looking at the solution.
How the recommendation is built
The questions follow the order in which the course's topics depend on each other. If you miss an early foundation, the recommendation starts there even if you get a later technique right, because recognising an advanced feature does not make up for a shaky prerequisite.
Confirm what you can apply
These queries do not change your test answers. They record separate written evidence and let you go back to the questions. Open the one that matches the recommended foundation.
1. Confirm in writing: read another part of the table
Practice
Read another part of the table
Show name and city for every customer, in that column order.
Expected result: 12 rows with the columns name, city, in that order. Row order does not matter.
View tables and data
Open this panel to see the full data.
Identify the two attributes you want to read.
SELECT keeps the left-to-right order in which you write the columns.
Separate name and city with a comma.
Solution explained
SELECT name, city FROM customers;Each row is still one person. The first column holds their name and the second their city.
2. Confirm in writing: build a catalogue
Practice
Build a catalogue
Show the id and name of every category. Keep that column order; any row order is fine.
Expected result: 5 rows with the columns id, name, in that order. Row order does not matter.
View tables and data
Open this panel to see the full data.
Each row will still represent one category.
Write both properties in the select list.
The source is categories and the list starts with id.
Solution explained
SELECT id, name FROM categories;Two properties per category give two columns and five rows. SELECT does not reduce the number of categories.
3. Confirm by typing: Combine absence with another condition
Practice
Combine absence with another condition
Show name and city of the active customers (active = 1) who have no email.
Expected result: 2 rows with columns name, city, in that order. The order of the rows does not matter.
View tables and data
Open this panel to see the full data.
There are two requirements that must be met at the same time: being active and having no email.
Absence is checked with IS NULL, not with = NULL.
The condition is active = 1 AND email IS NULL.
Solution explained
SELECT name, city FROM customers WHERE active = 1 AND email IS NULL;David Clark and Miles Lee meet both conditions. Peter Hill has no email either, but is not active. You can filter by email without displaying it.
4. Confirm by typing: Filter groups by a sum
Practice
Filter groups by a sum
Show category and SUM(stock) as units. Keep only the categories that add up to at least 10 units.
Expected result: 2 rows with columns category, units, in that order. The order of the rows does not matter.
View tables and data
Open this panel to see the full data.
The requirement refers to the units of the whole category, not to the stock of one product.
Group by category and calculate SUM(stock) before deciding which groups to keep.
The group threshold is HAVING SUM(stock) >= 10.
Solution explained
SELECT category, SUM(stock) AS units FROM products GROUP BY category HAVING SUM(stock) >= 10;Accessories (55) and Audio (11) pass; Storage (9) falls just short. The threshold measures the group's sum: in Audio, Speaker has 0 units and the category still passes.
5. Confirm in writing: keep even what is missing
Practice
Keep even the gaps
Show the customer name and p.id as order_id for every customer. Match only their shipped orders, inside ON.
Expected result: 14 rows with the columns name, order_id, in that order. Row order does not matter.
View tables and data
Open this panel to see the full data.
The table that must keep all its rows goes on the left.
The filter on the right-hand table must be part of the match.
Add p.status = 'shipped' to ON, joined with AND.
Solution explained
SELECT c.name, p.id AS order_id FROM customers AS c LEFT JOIN orders AS p ON c.id = p.customer_id AND p.status = 'shipped';The filter inside ON limits the matches without dropping any customers.
6. Confirm in writing: get a list
Practice
Get a list
Show the names of customers whose id is in the list of customer_id values from shipped orders. Use a subquery with IN.
Expected result: 7 rows with the column name, in that order. Row order does not matter.
View tables and data
Open this panel to see the full data.
Does the inner query return a single value or a list of values?
Because it returns a list of customer ids, the outer query uses IN rather than an operator such as >.
Structure: WHERE id IN (SELECT customer_id FROM orders WHERE status = 'shipped').
Solution explained
SELECT name FROM customers WHERE id IN (SELECT customer_id FROM orders WHERE status = 'shipped');IN compares each customer with a list. Their id appearing several times in the list does not multiply their row.
7. Confirm in writing: update another order
Practice
Update another order
Change only the status of order 105 to 'shipped'. Query id and status before and after the change.
We check the full final state: the change you were asked to make and that every other row is untouched. Review the output of each statement too.
Every attempt resets the data, so include all the steps you need to check in a single attempt.
View tables and data
Open this panel to see the full data.
Find the row by its id.
Keep the same condition before, during and after the UPDATE.
SET status = 'shipped' changes the attribute you were asked to change.
Solution explained
SELECT id, status FROM orders WHERE id = 105; UPDATE orders SET status = 'shipped' WHERE id = 105; SELECT id, status FROM orders WHERE id = 105;Only the status of order 105 changes. Its amount and the other orders stay as they were.
8. Confirm in writing: then restart per group
Practice
Then restart for each group
Show name, department and ROW_NUMBER as position. Restart for each department and number by salary descending and id ascending. Sort by department and position.
Expected result: 10 rows with the columns name, department, position, in that order. Keep the row order requested.
View tables and data
Open this panel to see the full data.
The position must start again in each department.
PARTITION BY defines the groups and ORDER BY the ranking.
Include id as a tiebreaker inside OVER.
Solution explained
SELECT name, department, ROW_NUMBER() OVER (PARTITION BY department ORDER BY salary DESC, id) AS position FROM employees ORDER BY department, position;Each department has its own position 1 without losing individual rows.
How to confirm the recommendation
- Open the suggested lesson. Read the example, but do not copy its solution.
- Complete a practice task. Write the query and predict at least one row of the result.
- Explain the decision. If you can justify every clause and fix a variant, carry on from the next lesson.
If the practice task is still hard, keep that entry point even if your overall score looks high.
Practise without following an exercise
If you already know what you want to try, use the free-form SQL editor with the AprenderSQL.es practice database.
Open the SQL editor →