Databases · Middle · Question 25 of 75

What does a window function like ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY created_at DESC) do?

Explanation

Filter WHERE rn = 1 in an outer query to get each user's latest order. Window functions also compute running totals, ranks and moving averages.

Further reading

Problem with a question

Databases · Middle · question 25

Test yourself

Take the Databases · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz