Question: Write a SQL query to find the average order value (total price) of orders made by each customer, sorted in descending order by the

Write a SQL query to find the average order value (total price) of orders made by each customer, sorted in descending order by the average order value Example: Input: Order table: order_id 1 2 3 4 5 6 Output customer_id 3 2 1 Query: customer_id 1 2 1 3 2 3 average_order_value 500 350 200 total_price 100 200 300 400 500 600 Copy code SELECT customer_id, AVG(total_price) AS average_order_value FROM Order GROUP BY customer_id ORDER BY average_order_value DESC
Step by Step Solution
3.44 Rating (154 Votes )
There are 3 Steps involved in it
The detailed ... View full answer
Get step-by-step solutions from verified subject matter experts
