To perform the following assignments, refer to the tables created in the JLDB_Bu
ID: 3898913 • Letter: T
Question
To perform the following assignments, refer to the tables created in the JLDB_Build_5.sql script at the beginning of the chapter. 1. Add a new row in the ORDERS table with the following data: Order# = 1021, Customer# = 1009, and Order date = July 20, 2009. 2. Modify the zip code on order 1017 to 33222. 3. Save the changes permanently to the database. 4. Add a new row in the ORDERS table with the following data: Order# = 1022, Customer# = 2000, and Order date = August 6, 2009. Describe the error raised and what caused the error. 5. Add a new row in the ORDERS table with the following data: Order# = 1023 and Customer# = 1009. Describe the error raised and what caused the error. 6. Create a script using substitution variables that allows a user to set a new cost amount for a book based on the ISBN. 7. Execute the script and set the following values: isbn = 1059831198 and cost = $20.00. 8. Execute a command that undoes the change in Step 7. 9. Delete Order# 1005. You need to address both the master order record and the related detail records. 10. Execute a command that undoes the previous deletion.
Explanation / Answer
If you have any doubts, please give me comment..
INSERT INTO ORDERS(Order#, Customer#, Order_date) VALUES(1021, 1009, '2009-07-20');
UPDATE ORDERS SET ZipCode = 33222 WHERE ZipCode = 1017;
INSERT INTO ORDERS(Order#, Customer#, Order_date) VALUES(1022, 2000, '2009-08-06');
-- if order# or customer# not in respective tables, then it raises foregin key constraint error
INSERT INTO ORDERS(Order#, Customer#) VALUES(1023, 1009);
Syntax:
UPDATE BOOK SET cost = <new cost> WHERE ibn = <replace ISBN NO>;
UPDATE BOOK SET cost = 20.00 WHERE isbn = 1059831198;
DELETE FROM ORDERS WHERE Order#=1005;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.