USE SYNTAX TO ANSWER THE FOLLOWING. Insert sample data from Figure 4a to Figure
ID: 3913583 • Letter: U
Question
USE SYNTAX TO ANSWER THE FOLLOWING.
Insert sample data from Figure 4a to Figure 4d to corresponding table (2 points).
Write an UPDATE statement to change values of ITEM.ItemDescription from Desk Lamp to Desk Lamps (2 points).
Write an SQL statement to create a view called SaleSummaryViewthat contains SALE.SaleID, SALE.SaleDate, SALE_ITEM.SaleItemID, SALE_ITEM.ItemID, ITEM.ItemDescription, and ITEM.ItemPrice (3 points).
Write an SQL statement to create a trigger called ValidItemthat limits possible ItemDescription insert to Antique Desk, Antique Desk Chair, Dining Table Linens, Candles, and Desk Lamp(3 points).
Explanation / Answer
Insert Statements:-
4a. insert into Customer values(1,'Shire','Robert','6225 Evanston Ave N','Seattle','WA',98103,'206-524-2433','Robert.Shire@somewhere.com');
4b.insert into Sale(1,1,'2014-12-14',3500.00,290.50,3790.50);
4c.insert into Item values (1,'Antique Desk','2014-11-07',1800.00,3000.00);
4d.insert into Sale_Item (1,1,1,3000.00);
Above are the insert statements for the 4 tables and chnage the values and execute for each row to insert.
Update Statement:-
update Item set ItemDescription='Desk Lamps' where ItemDescription='Desk Lamp';
The above is the update statements which finds the Itemdescription DeskLamp and updates it to Desk Lamps.
View:-
create view SaleSummary as select Sale.SaleID, Sale.SaleDate, Sale_Item.SaleItemID, Sale_Item.ItemID, Item.ItemDescription,Item.ItemPrice from Sale,Sale_Item,Item where Sale.SaleID=Sale_Item.SaleID and Sale_Item.SaleItemID=Item.ItemID;
Above is the view having all the required columns from the respective tables.
For the last Question trigger I didn't understand clearly from the question what you required. Please update the question or repost the question. Hope you understand.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.