Skip to content
Skills
Problems
Questions
Roles
Skills
Interview
Contest
Leaderboard
Problems
Questions
Roles
Skills
Interview
Contest
Leaderboard
Home
/
Data Analyst
/
Medium
/
Latest order per customer
medium
10 pts · first answer counts
sql
window-functions
Latest order per customer
Which approach returns exactly one row per customer: their most recent order?
Choose one answer
A.
GROUP BY customer_id and select MAX(created_at) with all other order columns
B.
Use ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY created_at DESC) and keep rows where it equals 1
C.
Use RANK() OVER (ORDER BY created_at) and keep rank 1
D.
Use SELECT DISTINCT customer_id, created_at
Submit answer
Report a problem
← Revenue doubled after a join
Running total of sales →