SQL practice: ROW_NUMBER, RANK and DENSE_RANK
Chapter 23 · 10 questions · included in full access
Question 1 · easy
Solve it in your browserNumber the products within each category, most expensive first.
Question 2 · easy
Solve it in your browserRank all employees by salary, highest first, using RANK().
Question 3 · medium
Solve it in your browserRank all employees by salary using DENSE_RANK() and compare with 23-2.
Question 4 · medium
Solve it in your browserNumber each customer's orders from oldest to newest.
Question 5 · medium
Solve it in your browserRank branches by how many orders they have.
Question 6 · medium
Solve it in your browserRank products within each category by total quantity sold.
Question 7 · medium
Solve it in your browserNumber all employees by salary within their role.
Question 8 · medium
Solve it in your browserFind the 2nd highest salary in the company using DENSE_RANK() inside a CTE.
Question 9 · hard
Solve it in your browserExplain when ROW_NUMBER() and RANK() would give different answers on our employees table.
Question 10 · hard
Solve it in your browserShow the cheapest product in each category. Only one row comes back. Fix it.
These questions are part of full access.
The first chapters of every track are free. Full access is a one-time payment.
See pricing