Explain the differences between delete, drop and truncate?
Find below the basic differences:
Delete: Delete is a DML statement and it can be implemented using ‘where’ clause and can also be rolled back. Syntax: DELETE FROM table_name WHERE column_name = column_value;
Drop: Drop is a DDL statement and it can’t be rolled back. By using this, the entire table and all its constraints and privileges will be removed. Syntax: DROP TABLE table_name;
Truncate: Truncate is a DDL statement and it is used to remove all the rows from a table but its structures, constraints, and indexes will remain as it is. Syntax: TRUNCATE TABLE table_name;
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.