Thursday, October 30, 2008

SQL - Drop, Truncate and Delete

Yeah.. basic things but it might be asked on the interview for Application Consultant position at Barclays.

What is the difference between Drop, Truncate and Delete?
Drop is to remove the whole table including the structure.
Truncate is to clean the table, delete all the data within the table.
Delete is to delete a record from the table.

So delete from table and truncate is the same?
The answer is no.

Delete will lock the table, but truncate will not.
That's the main difference!

No comments: