Question: ****Using mysql, my_guitar_shop.sql Chapter 12 Create a view named order_item_products that returns columns from the Orders, Order_Items, and Products tables. This view should return these

****Using mysql, my_guitar_shop.sql

Chapter 12

  1. Create a view named order_item_products that returns columns from the Orders, Order_Items, and Products tables.

This view should return these columns from the Orders table: order_id, order_date, tax_amount, and ship_date.

This view should return the product_name column from the Products table.

This view should return these columns from the Order_Items table: item_price, discount_amount, final_price (the discount amount subtracted from the item price), quantity, and item_total (the calculated total for the item).

  1. Create a view named product_summary that uses the view you created in exercise 4. This view should return summary information about each product.

Each row should include product_name, order_count (the number of times the product has been ordered) and order_total (the total sales for the product).

  1. Write a SELECT statement that uses the view that you created in exercise 5 to get total sales for the five best selling products. Sort the result set by the order_total column in descending sequence.

Chapter 13

The script that you create in the following exercises should use the same general structure as the script presented in Figure 13-1 in the book.

Write a script that creates and calls a stored procedure named test. This stored procedure should declare a variable and set it to the count of all products in the Products table. If the count is greater than or equal to 7, the stored procedure should display a message that says, The number of products is greater than or equal to 7. Otherwise, it should say, The number of products is less than 7.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!