Title: Difference between Delete, Truncate and Drop command in SQL
link : Difference between Delete, Truncate and Drop command in SQL
Difference between Delete, Truncate and Drop command in SQL
In this tutorial, we have given simple difference between delete, truncate and drop command in SQL language.
Delete: if we use delete command in a query than it simply deletes all data in a table not structure of the table.
SQL> delete table_name;
and all data can recover using rollback command.
SQL> rollback;
Truncate: if we use truncate command in a query than it deletes all data permanently and not structure of the table.
SQL> truncate table table_name;
and data can not recover using rollback command.
Another difference between delete and truncate command: if we are using auto increment variable in a table and we run delete command,after delete command if we insert any row than it simply increments the value of auto increment variable but in truncate command it starts value from one.
Drop: if we use drop command in a query than it deletes all data and structure of the table.
SQL> drop table table_name;
Delete: if we use delete command in a query than it simply deletes all data in a table not structure of the table.
SQL> delete table_name;
and all data can recover using rollback command.
SQL> rollback;
Truncate: if we use truncate command in a query than it deletes all data permanently and not structure of the table.
SQL> truncate table table_name;
and data can not recover using rollback command.
Another difference between delete and truncate command: if we are using auto increment variable in a table and we run delete command,after delete command if we insert any row than it simply increments the value of auto increment variable but in truncate command it starts value from one.
Drop: if we use drop command in a query than it deletes all data and structure of the table.
SQL> drop table table_name;
That's Difference between Delete, Truncate and Drop command in SQL
That's an article Difference between Delete, Truncate and Drop command in SQL
This time, hopefully can benefit for you all. Well, see you in other article postings.
You are now reading the article Difference between Delete, Truncate and Drop command in SQL With link address https://u-see1.blogspot.com/2017/06/difference-between-delete-truncate-and.html
Belum ada tanggapan untuk "Difference between Delete, Truncate and Drop command in SQL"
Post a Comment