premiere product excersice answers

7
 Answer the 13 questions in the case study  , Premiere Products Exercises: P age 150.  Answer 1: TopLevelCust CustomerNum CustomerName Street City State Zip Balance CreditLimit 282 Brookings Direct 3827 Devon Grove FL 33321 $431.50 $10,000.00 462 Bargains Galore 3829 Central  Grove FL 33321 $3,412.00 $10,000.00 524 Kline's  838 Ridgeland Fillmore FL 33336 $12,762.00  $15,000.00 608 Johnson's Department Store 372 Oxford Sheldon FL 33553 $2,106.00 $10,000.00 Answer 2: a) SELECT PART.PART_NUM, PART.DESCRIPTION, PART.PRICE, ORDERS.ORDER_NUM, ORDERS.ORDER_DATE, ORDER_LINE.NUM_ORDERED, ORDER_LINE.QUOTED_PRICE FROM (PART INNER JOIN ORDER_LINE ON PART.PART_NUM = ORDER_LINE.PART_NUM) INNER JOIN ORDERS ON ORDER_LINE.ORDER_NUM = ORDERS.ORDER_NUM; b) SELECT PARTOrder.PART_NUM, PARTOrder.DESCRIPTION, PARTOrder.ORDER_NUM, PARTOrder.QUOTED_PRICE FROM PARTOrder WHERE (((PARTOrder.QUOTED_P RICE)>100)); c) After executing the query, the figure below depicts the data in the view. PARTOrder Query PART_NUM DESCRIPTION ORDER_NUM QUOTED_PRICE 

Upload: carlos-vallejos

Post on 21-Jul-2015

3.098 views

Category:

Documents


0 download

TRANSCRIPT

Answer the 13 questions in the case study, Premiere Products Exercises: Page 150. Answer 1: TopLevelCustCustomerNum CustomerName 282 Brookings Direct 462 Bargains Galore 524 Kline's 608 Johnson's Department Store Street 3827 Devon 3829 Central 838 Ridgeland 372 Oxford City State Zip Balance CreditLimit Grove FL 33321 $431.50 $10,000.00 Grove FL 33321 $3,412.00 $10,000.00 Fillmore FL 33336 $12,762.00 $15,000.00 Sheldon FL 33553 $2,106.00 $10,000.00

Answer 2:a)

SELECT PART.PART_NUM, PART.DESCRIPTION, PART.PRICE, ORDERS.ORDER_NUM, ORDERS.ORDER_DATE, ORDER_LINE.NUM_ORDERED, ORDER_LINE.QUOTED_PRICE FROM (PART INNER JOIN ORDER_LINE ON PART.PART_NUM = ORDER_LINE.PART_NUM) INNER JOIN ORDERS ON ORDER_LINE.ORDER_NUM = ORDERS.ORDER_NUM;

b)

SELECT PARTOrder.PART_NUM, PARTOrder.DESCRIPTION, PARTOrder.ORDER_NUM, PARTOrder.QUOTED_PRICE FROM PARTOrder WHERE (((PARTOrder.QUOTED_PRICE)>100));

c)

After executing the query, the figure below depicts the data in the view.

PARTOrder QueryPART_NUM DESCRIPTION ORDER_NUM QUOTED_PRICE

PARTOrder QueryPART_NUM DESCRIPTION ORDER_NUM QUOTED_PRICE DR93 DW11 KL62 KT03 BV06 CD52 DR93 KV29 Gas Range Washer Dryer Dishwasher Home Gym Microwave Oven Gas Range Treadmill 21610 21610 21613 21614 21617 21617 21619 21623 $495.00 $399.99 $329.95 $595.00 $794.95 $150.00 $495.00 $1,290.00

Answer 3:SELECT ORDER_LINE.ORDER_NUM, [ORDER_LINE]![NUM_ORDERED]*[ORDER_LINE]![QUOTED_PRICE] AS Expr1 FROM ORDER_LINE;

OrdTotORDER_NUM Expr1 21608 $241.45 21610 $495.00 21610 $399.99 21613 $1,319.80 21614 $1,190.00 21617 $1,589.90 21617 $600.00 21619 $495.00 21623 $2,580.00

Answer 4:a) CREATE INDEX PartIndex1 ON OrderLine (PartNum) ; b) CREATE INDEX PartIndex2 ON Part (Warehouse) ; c) CREATE INDEX PartIndex3 ON Part (Class, Warehouse) ; d) CREATE INDEX PartIndex4 ON Part (Warehouse, OnHand DESC) ;

Answer 5:DROP INDEX PartIndex3 ON Part

Answer 6:

Answer 7: PartPartNum Description OnHand Class Warehouse Price Allocation AT94 Iron 50 HW 3 $24.95 0 BV06 Home Gym 45 SG 2 $794.95 0 CD52 Microwave Oven 32 AP 1 $165.00 0 DL71 Cordless Drill 21 HW 3 $129.95 0 DR93 Gas Range 8 AP 2 $495.00 0 DW11 Washer 12 AP 3 $399.99 0 FD21 Stand Mixer 22 HW 3 $159.95 0 KL62 Dryer 12 AP 1 $349.95 0 KT03 Dishwasher 8 AP 3 $595.00 0 KV29 Treadmill 9 SG 2 $1,390.00 2

Answer 8: PartPartNum Description OnHand Class Warehouse Price AT94 Iron 50 HW 3 $24.95 BV06 Home Gym 45 SG 2 $794.95 CD52 Microwave Oven 32 AP 1a $165.00 DL71 Cordless Drill 21 HW 3 $129.95 DR93 Gas Range 8 AP 2 $495.00 DW11 Washer 12 AP 3 $399.99 FD21 Stand Mixer 22 HW 3 $159.95 KL62 Dryer 12 AP 1a $349.95 KT03 Dishwasher 8 AP 3 $595.00 KV29 Treadmill 9 SG 2 $1,390.00

Answer 9: PartPartNum Description OnHand Class Warehouse Price AT94 Iron 50 HW 3 $24.95 BV06 Home Gym 45 SG 2 $794.95 CD52 Microwave Oven 32 AP 1 $165.00 DL71 Cordless Drill 21 HW 3 $129.95 DR93 Gas Range 8 AP 2 $495.00 DW11 Washer 12 AP 3 $399.99 FD21 Stand Mixer 22 HW 3 $159.95 KL62 Dryer 12 AP 1 $349.95 KT03 Dishwasher 8 AP 3 $595.00 KV29 Treadmill 9 SG 2 $1,390.00

Answer 10:DROP TABLE Part;

Answer 11:DELIMETER $$ CREATE PROCEDURE Change_Price (PNum CHAR (4) , P_Price DECIMAL (4,2)) BEGIN UPDATE Part SET Price = P_Price WHERE PartNum = AT94 ; END $$ DELIMETER ;

Answer 12: a) DELIMETER $$CREATE TRIGGER AddNewCustomer AFTER INSERT ON Customer FOR EACH ROW BEGIN UPDATE Rep SET Comm = Balance * Rate WHERE CustNum = New.CustNum ; END $$ DELIMETER ;

b) DELIMETER $$CREATE TRIGGER UpdateNewCustomer AFTER UPDATE ON Customer FOR EACH ROW BEGIN UPDATE Rep SET Comm = Balance New.Balance * Rate WHERE Customer.CustNum = New.CustNum ; END $$ DELIMETER ;

c) DELIMETER $$CREATE TRIGGER DeleteNewCustomer AFTER DELETE ON Customer FOR EACH ROW BEGIN UPDATE Customer SET Comm = Balance Old.Balance WHERE Customer = Old.CustNum ; END $$ DELIMETER ;