Medium
HAVING

Repeat Customers

Find customers who placed more than one order. Return columns: customer_name, order_count. Order results by: order_count DESC, customer_name.

Preparing the interactive SQL workspace...

Challenge overview

What you will practice

Find customers who placed more than one order. Return columns: customer_name, order_count. Order results by: order_count DESC, customer_name.

Difficulty
Intermediate
SQL concept
HAVING

Public schema and sample data

customers

id INTEGERname TEXTemail TEXTcountry TEXTjoined_date TEXT
1Acme Corpacme@corp.comUSA2020-01-15
2TechStart Ltdts@techstart.ioUK2020-03-22
3DataFlow Incinfo@dataflow.comUSA2021-06-10

products

id INTEGERname TEXTcategory TEXTprice REALstock INTEGER
1Analytics DashboardSoftware299999
2Data WarehouseInfrastructure149950
3ML PipelineSoftware799999

orders

id INTEGERcustomer_id INTEGERorder_date TEXTtotal_amount REALstatus TEXT
112024-01-102697completed
222024-01-15799completed
312024-02-011499completed

order_items

id INTEGERorder_id INTEGERproduct_id INTEGERquantity INTEGERunit_price REAL
1113299
214899
3231799