Wednesday, February 1, 2017

DIFFERENCE BETWEEN TRUNCATE AND DELETE COMMANDS IN SQL


Truncate
Delete
Definition
It removes all the rows from table.
It is used to remove specific or all the rows from table.
Syntax
Truncate table table_name;
Delete from  table_name;
Delete from table_name where column=value;
Example
Truncate table employees;
 Delete from employees;
Delete from employees where employee_name like 'Sam%'
Commit
 Truncate is auto committed.
 Commit should be given after delete.

No comments: