Sort results
SQL
Easy
3 views
Problem Description
From Orders(order_id, order_date), show the latest 10 orders. Sort by order_date (newest first). If dates are same, you can sort by order_id too.
Sample Test Case
Input:
Orders(order_id, order_date)
Constraints
Think: ORDER BY + LIMIT
Official Solution
SELECT order_id, order_date FROM Orders ORDER BY order_date DESC, order_id DESC LIMIT 10;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!