HOW TO DROP, TRUNCATE AND DELETE TABLE

DROP TABLE TRUNCATE TABLE AND DELETE

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

Leave a Reply

Your email address will not be published. Required fields are marked *