213k views
1 vote
To remove all of the content from the Students table but keep the schema, which statement should you use?

a) DELETE FROM Students
b) TRUNCATE TABLE Students
c) DROP TABLE Students
d) SELECT * FROM Students WHERE 1=0

User Uamanager
by
7.8k points

1 Answer

5 votes

Final answer:

To clear all data from the Students table without dropping the table itself, you should use the 'TRUNCATE TABLE Students' command. It quickly removes all data while maintaining the table structure.

Step-by-step explanation:

To remove all of the content from the Students table but keep the schema, the correct statement to use is b) TRUNCATE TABLE Students. The TRUNCATE TABLE command removes all data from a table, but the table structure and its columns, constraints, indexes, and so on, remain intact. In contrast, DELETE FROM Students would also remove all the data, but it does it row by row and can be rolled back if not committed, and it can also be subject to where conditions. DROP TABLE Students would remove the entire table including its schema, and SELECT * FROM Students WHERE 1=0 simply retrieves no rows but does not alter the table content at all.

User Mmmdreg
by
8.4k points