Question: This Is based on Murach's MySQL 3rd edition with the my_guitar_shop databases I need help writing the SQL queries -------------------------------------------------------------------------------------- SELECT oi.order_id, sum((prod.list_price - oi.discount_amount)
This Is based on Murach's MySQL 3rd edition with the my_guitar_shop databases
I need help writing the SQL queries
--------------------------------------------------------------------------------------
SELECT oi.order_id, sum((prod.list_price - oi.discount_amount) * oi.quantity) as total_amount
FROM products prod JOIN order_items oi on oi.product_id = prod.product_id
GROUP BY oi.order_id ORDER BY oi.order_id ASC
--------------------------------------------------------------------------------------
Modify the solution above so the column that contains the total amount for each order contains a cumulative total by item amount.
Add another column to the SELECT statement that uses an aggregate window function to get the average item amount for each order.
Modify the SELECT statement so it uses a named window for the two aggregate functions.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
