Difference between table truncate and table delete

# Frequently asked question in interview is ' what is the difference b/w delete,truncate and drop'.


DELETE

1. Delete is a DML operation, it can be rollback
2. By using it rows from table can delete.
3. It can used with indexs and views.


TRUNCATE


1.  Truncate is a DDL operation, it can not be rollback
2.  By using it all rows from table deleted.
3. It cannot used with indexes and views.

DROP

1.  Truncate is a DDL operation, it can not be rollback
2.  By using it whole table delete including the records.
3.  It cannot used with indexes and views.

Comments

Post a Comment

Popular posts from this blog

How To Create Table In MSSQL

How To Find Nth Salary Of Employee

How To Find Second Max Salary Of Employee