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

Execute the transactions below to modify/add to the data entered in the previous

ID: 3725335 • Letter: E

Question

Execute the transactions below to modify/add to the data entered in the previous step (COMMIT the transactions if not automatically committed). Print the statements and output for each transaction before proceeding to Step IV:

Customer table

Change the phone number of Customer 85 to ‘2145551234’

Add Customer 120 (Amanda Green, no phone number)

Reservation table

Change the checkout date for reservation 1001 to 2/8/2018

Add a reservation:

            ResID              CheckIn          CheckOut        CustID            AgentID                    

1011                3/1/2018          3/4/2018          120                  14

  

      ResDetail table

Change the RateCode of ResID 1003 to C

Change the RateAmt of ResID 1003 to $89

Add the following details for reservation 1011:

RoomNum     RateType         Rate  

                        224                  W                    $119

                        225                  W                    $129

ResDetail Customer CustlD CustFName CustLName CustPhone CustType LoyaltylD Reservation ResID CheckinDate CheckOutDate CustID AgentID Room CustType CustType CustTypeDesc RoomNum RateType RateAmt RoomType Agent AgentlD AgentFName AgentLName AgentType RateType RateType RateTypeDesc RoomType RoomType RoomTypeDesc AgentType AgentType AgentTypeDesc

Explanation / Answer

// Updating Customer table

UPDATE Customer

SET CustPhone = ‘214551234’

WHERE CustID = 85;

// Inserting values to Customer table

INSERT INTO Customer (CustID, CustFName, CustLName) VALUES (120, ‘Amanda’, ‘Green’)

// Updating values reservation table

UPDATE TABLE Reservation

SET CheckOutDate = ‘2/8/2018’

WHERE ResID = 1001;

// Adding a row in Reservation table

INSERT INTO Reservation VALUES (1011, ‘3/1/2018’, ‘3/4/3018’, 120, 14);

// Updating ResDetail table

UPDATE ResDetail

SET RateType = ‘C’,

RateAmt = 89

WHERE ResID = 1003;

// Updating ResDetail table for reservation 1011, the detail is updated twice so only last detail // will persist.

UPDATE ResDetail

SET RoomNum = 224,

RateType = ‘W’,

Rate = 119

WHERE ResID = 1011;

UPDATE ResDetail

SET RoomNum = 225,

RateType = ‘W’,

Rate = 129

WHERE ResID = 1011;

// Commiting the all the transactions.

COMMIT;