Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My Guitar Shop Exercises for Murachs MySQL (3rd Edition) #8-10 please Tables: 8. Write a SELECT statement that answers this question: What is the total

My Guitar Shop Exercises for Murachs MySQL (3rd Edition)

#8-10 pleaseimage text in transcribedTables:

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

8. Write a SELECT statement that answers this question: What is the total quantity purchased for each product within each category? Return these columns: The category_name column from the category table The product_name column from the products table The total quantity purchased for each product with orders in the Order_items table 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 they're for summary rows. 9. Write a SELECT statement that uses an aggregate window function to get the total amount of each order. Return these columns: The order_id column from the Order_items table The total amount for each order item in the Order_items table (Hint: You can calculate the total amount by subtracting the discount amount from the item price and then multiplying it by the quantity) The total amount for each order Sort the result set in ascending sequence by the order_id column. 10. Modify the solution to exercise 9 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. SCHEMAS a Filter objects my_guitar_shop Tables 3 addresses administrators categories 3 customers Border_items 3 orders products > Columns .product_id category_id product_code product_name description list price discount_percent date_added Indexes SCHEMAS a Filter objects ap my_guitar_shop Tables addresses administrators categories > Columns category_id category_name Indexes Foreign Keys Triggers customers order_items orders products Views Stored Procedures Information Table: categories SCHEMAS Filter objects addresses administrators categories customers order_items orders > Columns order_id customer_id order_date ship_amount tax_amount ship_date ship_address_id card_type card_number card_expires billing_address_id Indexes Information SCHEMAS a Filter objects my_guitar_shop Tables addresses administrators categories customers order_items > Columns item_id order_id product_id item_price discount_amount quantity Indexes Foreign Keys Triggers orders products Information

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions

Question

7. Determine what feedback is provided to employees.

Answered: 1 week ago