Skip to main content
Admissions guidance, study banks, and career tools โ€” get started on Shalyam

First Order of Each Customer

Return the first (earliest) order of every customer with its id, customer_id, order_date and amount. Order by customer_id.

Table schema

Orders(id INT PRIMARY KEY, customer_id INT, order_date DATE, amount INT)

Sample data

id | customer_id | order_date | amount
1 | 1 | 2026-01-05 | 100
2 | 1 | 2026-01-10 | 200
3 | 2 | 2026-01-03 | 50
4 | 2 | 2026-01-04 | 75

Discussion

No discussions yet.

Rewards ยท v2.1

Join Shalyam Newsletter

Get exclusive insights with every issue: education, research and innovation news.

One email a week. Unsubscribe any time.