You have a table named ITEMS with the following fields:
ID (integer, primary key. auto generated)
Description (text)
Completed (Boolean)
You need to insert the following data in the table:
“Cheese”, False
Which statement should you use?
A.
INSERT INTO ITEMS (ID, Description, Completed) VALUES (1, ‘Cheese’, 0)
B.
INSERT INTO ITEMS (Description, Completed) VALUES (‘Cheese’, 1)
C.
INSERT INTO ITEMS (10, Description, Completed) VALUES (NEWID(), ‘Cheese’,
6)
D.
INSERT INTO ITEMS (Description, Completed) VALUES (‘Cheese’, 6)
There is no correct answer for this one. The best answer would be A, but the problem is the key is autogenerated. The best answer would be:
INSERT INTO ITEMS (Description, Completed) VALUES (‘Cheese’, 0) as the ID would create the next one in line. Answer A could cause a duplicate value to be created unless I totally miss my mark.