Which statement removes all rows from the table old_data but keeps the table structure?

Study for the SQL Basics Test. Improve your knowledge with multiple choice questions and detailed explanations. Prepare effectively to master SQL concepts!

Multiple Choice

Which statement removes all rows from the table old_data but keeps the table structure?

Explanation:
Truncating a table clears all its data quickly while preserving the table’s schema. The statement removes every row from the table but leaves the table itself intact with its columns, data types, constraints, and indexes still in place, so you can immediately start inserting new data. It’s usually faster than deleting rows one by one because it deallocates entire data pages and logs less information, and in many systems it also resets identity/auto-increment counters. The other options either drop the table entirely, are not valid, or would delete rows in a way that doesn’t provide the same fast data purge while keeping the structure. That combination of removing all rows while keeping the table definition is exactly what a truncate operation does.

Truncating a table clears all its data quickly while preserving the table’s schema. The statement removes every row from the table but leaves the table itself intact with its columns, data types, constraints, and indexes still in place, so you can immediately start inserting new data. It’s usually faster than deleting rows one by one because it deallocates entire data pages and logs less information, and in many systems it also resets identity/auto-increment counters. The other options either drop the table entirely, are not valid, or would delete rows in a way that doesn’t provide the same fast data purge while keeping the structure. That combination of removing all rows while keeping the table definition is exactly what a truncate operation does.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy