Have you failed a job interview?
Send us your job interview questions and get correct answers.

What is a difference between DROP TABLE and TRUNCATE TABLE and DELETE FROM?

Experience Level: Medior
Tags: Databases



  • DROP TABLE - removes the table structure and data.
  • TRUNCATE TABLE - removes all data from table but preserves the structure so the table can be used later. The operation cannot be used on tables that have foreign keys. It's ultra fast as it's minimally logged, so it uses less transaction log space. Fewer locks are typically used. After successful executions, zero rows are left in the table.
  • DELETE FROM - removes data matching criteria from table. It's slower than TRUNCATE TABLE, but it can be used for removing just couple of rows, not eveything.
Related Databases job interview questions


No Comments Yet.
Be the first to tell us what you think.