Easy Aggregation Free

SQL interview question: Average Order Value per Customer

Average Order Value by Customer

The payments team needs to calculate average transaction size per customer to identify high-value customers.

Calculate the average order value (total_amount) for each customer, rounded to 2 decimal places.

Return customer_id and avg_order_value. Order by customer_id.

Skills: AVG aggregation and ROUND

Tables

orders 15 rows
  • order_id integer PK
  • customer_id integer → customers
  • order_date text
  • total_amount real
  • status text
order_idcustomer_idorder_datetotal_amountstatus
11012024-01-20249.99delivered
21012024-03-151999.99delivered
41012024-09-0579.99delivered

Keep going