Delete, truncate, drop command in SQL
What is difference delete , truncate and drop command in SQL.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Akkiraju IvaturiPosted Aug 28, 2012, 8:33 AM
Any views or stored procedures depending on the dropped table must be explicitly dropped.
Delete removes rows from the table if a criteria is specified otherwise deletes all the rows. If it encounters foreign key constraint, it gets cancelled and will not delete row. it logs the individual row deletion.
Truncate deletes all the rows in the table and it does not log every row delete and so it is faster.
R ACHUTHAPosted Aug 28, 2012, 8:02 AM
And delete command did not reset the identity value of the table. Truncate command reset the identity value of table that means if you truncate a table then if there is any identity value in the table it will reset to the initial value.
Drop command delete the entire table data and table schema.
Dhara MaheshwariPosted Aug 28, 2012, 7:58 AM
Truncate command deletes all the rows from table, but it doesn't delete the structure of table only the content of table,
drop command will remove the whole table in this table structure will also be deleted.
The priviledges, indexes created on table will also be deleted..
Drop and Truncate are DDL commands while Delete is DML command..
We can't rollback using Truncate, but we can rollback using DELETE..
Truncate is faster as compared to delete
U may also refer to below link:
http://www.orafaq.com/faq/difference_between_truncate_delete_and_drop_commands