SQL Truncate

1.What is the purpose of the TRUNCATE statement in SQL?
  • A. To remove specific rows based on a condition
  • B. To delete all rows from a table quickly and efficiently
  • C. To remove a column from a table
  • D. To rename a table

To delete all rows from a table quickly and efficiently

To delete all rows from a table quickly and efficiently

2.Which of the following is TRUE about TRUNCATE?
  • A. It is a DML command
  • B. It can be rolled back like DELETE
  • C. It resets auto-increment counters in many DBMSs
  • D. It deletes data row by row

It resets auto-increment counters in many DBMSs

It resets auto-increment counters in many DBMSs

3.Can you use a WHERE clause with TRUNCATE?
  • A. Yes, always
  • B. Only in SQL Server
  • C. No, TRUNCATE affects the entire table
  • D. Only with constraints

No, TRUNCATE affects the entire table

No, TRUNCATE affects the entire table

4.What happens to the structure of the table after a TRUNCATE command?
  • A. The table is dropped
  • B. The structure remains intact
  • C. The structure is reset
  • D. The table is renamed

The structure remains intact

The structure remains intact

5.Which is usually faster: DELETE or TRUNCATE?
  • A. DELETE
  • B. TRUNCATE
  • C. Both are equally fast
  • D. Depends on the table size

TRUNCATE

TRUNCATE