Repeat buyers

EasyGROUP BY and HAVINGE-commerce

The problem

Find customers who have at least 3 delivered orders.

Return customer_id and delivered_orders (the count of their delivered orders).

Tables · Online shop

Click a table or column name to insert it into your query.

  • INTEGER · primary key
  • TEXT
  • TEXT · can be NULL
  • DATE
Sample rows (10 total)
Sample rows from customers
customer_idnamecitysignup_date
1Aarav MehtaMumbai2025-01-10
2Diya NairBengaluru2025-01-18
3Kabir SinghDelhi2025-02-02
4Meera IyerChennai2025-02-14
5Rohan DasKolkata2025-03-01

  • INTEGER · primary key
  • INTEGER · → customers
  • DATE
  • TEXT · delivered | cancelled | returned | pending
  • INTEGER · rupees
Sample rows (20 total)
Sample rows from orders
order_idcustomer_idorder_datestatusamount
112025-05-01delivered1200
212025-05-15delivered800
312025-06-02cancelled500
422025-05-03delivered2500
522025-05-20delivered450

Next: Spend per customer →

Ctrl/⌘ + Enter runs the query. Table and column names are suggested as you type. Press Esc then Tab to leave the editor with the keyboard.

Expected output (3 rows)
Expected output
customer_iddelivered_orders
23
43
63

Row order doesn’t matter for this question. Numbers are compared with a tiny tolerance; text must match exactly.

Stuck?

Stored on this device only. Your latest query and “solved” status are remembered in this browser only. They don’t sync between devices, and clearing your browser data removes them.