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

*For this assignment I need at least 3 changes to the script.* Given a QITEM tab

ID: 3871732 • Letter: #

Question

*For this assignment I need at least 3 changes to the script.*

Given a QITEM table, from the QSALE DB, copy its content into NEWITEM table.

Make three unrelated but elementary changes (one record update, one new record insert, and one old record delete) making sure you do not leave any duplicates.

Provide as many different ways using only SQL (no triggers etc.) to accomplish the following task: compare the tables QITEM and NEWITEM to assess if they are now exactly the same (and they should not).

Explanation / Answer

Hi,
1. To copy data and structure of the new table, you can use
CREATE TABLE newitem AS SELECT * FROM qitem;
INSERT INTO newitem SELECT * FROM qitem;
2. to modify data
insert- INSERT INTO newitem VALUES ('tent-9 person', 'f', 'khaki');
delete- delete from newitem where itemname='compass'
update- update newitem set itemcolor='black' where itemname='hammock'
3. Now, to compare 2 tables, we need to check manually all fields because there is no distinct field in both tables