← All SQL interview questions

Customers who ordered in every month of Q3

MediumGROUP BYZoomInfoPayPal

A retention analyst wants the most consistent buyers: customers who placed at least one order in each of July, August and September 2026.

From store_orders, return customer_id, orders_in_quarter and total_spent (both counting only orders from 1 July to 30 September 2026) for customers active in all three months. Order by customer_id.

Sample data

Table: store_orders

20 row(s) · showing first 8

order_idINTcustomer_idINTorder_dateDATEorder_amountNUMERIC(10,2)
112026-07-051200.00
212026-08-11900.00
312026-09-141500.00
412026-09-30600.00
522026-07-203000.00
622026-09-022500.00
722026-10-031800.00
832026-07-08700.00