Nth Highest Value
Medium
3
81.3% Acceptance
Let's test your ability to work with ranking functions and subqueries to retrieve specific data points from a dataset.
Instructions:
- From the
Invoice
table, retrieve the 3rd highest invoice total. - Name the column in your result as
ThirdHighestTotal
. - Your result should only contain this one column.
- Order your result by
ThirdHighestTotal
in descending order.
Hints:
- You might want to use the
ROW_NUMBER()
function in combination with a subquery to achieve this. - Remember to use
ORDER BY
in your subquery to rank the invoice totals in descending order. - Filtering by the row number in your outer query will help you get the 3rd highest value.
- Always use double quotes for table and column names for clarity.