New vs Returning Customers
Medium
Web & Marketing Analytics
Label every order 'New' if it is the customer's first order and 'Returning' otherwise. Return id and label ordered by id.
Table schema
Orders(id INT PRIMARY KEY, customer_id INT, order_date DATE)Sample data
id | customer_id | order_date
1 | 1 | 2026-01-01
2 | 2 | 2026-01-02
3 | 1 | 2026-01-10
4 | 3 | 2026-01-11
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.