Home / SQL / Practice problems / Easy

Orders per status

Easy

Show each order status and how many orders have it.

Tables: customers(customer_id, name, city, country, joined) · products(product_id, name, category, price) · orders(order_id, customer_id, order_date, status) · order_items(order_id, product_id, quantity, unit_price)

Your query
Show the expected result
statusorders
cancelled7
delivered32
pending5
shipped7

4 rows

Show a solution
SELECT status, COUNT(*) AS orders FROM orders GROUP BY status;

SQL used

New to SQL? The free SQL course teaches everything these problems use, with a self-checking exercise in every lesson.