SQL Mastery Quiz

10:00

Subqueries, CTEs, window functions, transactions and query tuning. · 10 questions

Question 1 of 10
Which keyword starts a Common Table Expression?
Question 2 of 10
Which statement permanently saves the changes made in a transaction?
Question 3 of 10
Which window function gives the value from the previous row?
Question 4 of 10
In `EXPLAIN` output, what does `type = ALL` indicate?
Question 5 of 10
Scores are 90, 80, 80, 70. What `DENSE_RANK()` (ORDER BY score DESC) does 70 get?
Question 6 of 10
Why can this query return zero rows even though some customers never ordered?
SELECT name FROM customers
WHERE id NOT IN (SELECT customer_id FROM orders);
Question 7 of 10
Which index can MySQL use for `WHERE status = 'PAID'` alone?
Question 8 of 10
Why does this filter usually prevent the use of an index on `created_at`?
SELECT * FROM orders WHERE YEAR(created_at) = 2026;
Question 9 of 10
Two cashiers may sell the last box at the same time. What prevents overselling inside a transaction?
Question 10 of 10
With `SUM(revenue) OVER (PARTITION BY branch ORDER BY month)` and no explicit frame, what is computed?