DROP VS TRUNCATE VS DELETE In SQL

HOW TO DROP, TRUNCATE AND DELETE TABLE?

DROP TABLE, TRUNCATE TABLE AND DELETE IN SQL
Key WordSyntaxExplanation
DROP TABLEDROP TABLE <table_name>;DROP TABLE is used to delete a table definition and all data from a table
TRUNCATE TABLETRUNCATE TABLE <table_name>;TRUNCATE TABELE is used to remove all rows or complete data from a table. It doesnโ€™t delete the structure of table. Identity column is reset to its seed value if the table contains any identity column  
DELETEDELETE FROM <table_name>;  It will delete all the records in table. DELETE retains the identity of the column value.  
DELETEDELETE FROM <table_name> WHERE<condition/expression>;  Remove rows or specific records from a table based on a WHERE condition.

DROP TABLE, TRUNCATE TABLE AND DELETE


Posted

in

Tags:

Comments

Leave a Reply