Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

help please(oracle sql) Create a view named order_item_products that returns col

ID: 3683982 • Letter: H

Question

help please(oracle sql)

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 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).

This view should return the product_name column from the products table

Explanation / Answer

CREATE VIEW order_item_products
AS SELECT O.order_id, O.order_date, O.tax_amount,O.ship_date,
OI.item_price,OI.Discount_amount, OI.item_price-OI.Discount_amount as final_price,OI.quantity,count(OI.order_id) as item_total,
P.product_name
FROM Orders O, Orders_Items OI, Products P
WHERE O.order_id=OI.order_id and OI.product_id=P.product_id;