Skip to content
Skills
Problems
Questions
Roles
Skills
Interview
Contest
Leaderboard
Problems
Questions
Roles
Skills
Interview
Contest
Leaderboard
Home
/
Data Scientist
/
Medium
/
Latest order per customer
medium
10 pts · first answer counts
sql
window-functions
Latest order per customer
Which approach returns only the most recent order for each customer?
Choose one answer
A.
SELECT * FROM orders ORDER BY order_date DESC LIMIT 1;
B.
Use ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY order_date DESC) and keep rows where it equals 1
C.
SELECT DISTINCT customer_id, order_date FROM orders;
D.
SELECT customer_id, MAX(order_id) FROM orders;
Submit answer
Report a problem
← Testing 20 metrics at once
Overall rate flips when split →