Question: Write a SELECT statement that answers this question: What is the total quantity purchased for each product within each category? Return these columns: a) The
Write a SELECT statement that answers this question: What is the total quantity purchased for each product within each category? Return these columns:
a) The CategoryName column from the category table
b) The ProductName column from the products table
c) The total quantity purchased for each product with orders in the OrderDetails table
d) Use the WITH ROLLUP operator to include rows that give a summary for each category name as well as a row that gives the grand total. Use the IF and GROUPING functions to replace null values in the category_name and product_name columns with literal values if theyre for summary row
New Tab MySQL Workbench X 1 + Local instance MySQL80 X File Edit View Query Database sed : Server Tools Scripting Help SOL SOL 10 o NON IN Jo2 SQL Additions I 1 Jump to X 7. III. 8 Ishani Nanavaty_guitar_shop (4) Assignment3No3 Assignment3N04* Assignment3N05 Assignment3N Limit to 1000 rows SELECT categories.category_name, products.product_name, SUM(order_items.quantity) from products INNER JOIN categories on products.category_id = categories.category_id INNER JOIN order_items GROUP BY products.category_id, products.product_id with rollup 9 Outlod Navigator SCHEMAS Filter objects New me ap ex ishaninanavaty_guitar_shop Tables Favorite addresses 3 administrators categories Sent Ite Administration Schemas Information Deleted No object selected Add fav Automatic context help is disabled. Use the toolbart manually get help for the turing current caret position or to hoose toggle automatic help.na. 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
