Day 11

Quiz

1: What is wrong with the following statement?
DELETE COLLECTION;
A1: If you want to delete all records from the COLLECTION table, you must use the following syntax:
DELETE FROM COLLECTION;

Keep in mind that this statement will delete all records. You can qualify which records you want to delete by using the following syntax:

DELETE FROM COLLECTION
WHERE VALUE = 125

This statement deletes all records with a value of 125.

2: What is wrong with the following statement?
INSERT INTO COLLECTION
SELECT * FROM TABLE_2
A2: This statement was designed to insert all the records from TABLE_2 into the COLLECTION table. The main problem here is using the INTO keyword with the INSERT statement. When copying data from one table in another table, ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.