-- Quick, no possible rollback
TRUNCATE TABLE my_table;
-- With possible rollback
DELETE FROM my_table;
COMMIT; -- or ROLLBACK;
DELETE:
1.Delete command is used to delete a row in a table.
2.You can rollback data after using delete statement.
3.It is a DML command.
4.It is slower than truncate statement.
-- DELETE Syntax
DELETE FROM table_name WHERE condition;
TRUNCATE:
1.Truncate is used to delete all the rows from a table
2.You cannot rollback data.
3.It is a DDL command.
4.It is faster.
-- TRUNCATE Syntax
TRUNCATE TABLE table_name;