Answer: Using TRUNCATE, we cannot restore the deleted data.
Syntax:
TRUNCATE TABLE table_name;
Example:
To delete all the rows from employee table, the query would be like,
TRUNCATE TABLE employee;
Unlike using DELETE, we can restore the data, as the physical data will not get deleted.
Syntax:
DELETE FROM table_name [WHERE condition];
Example:
To delete an employee with id 100 from the employee table, the sql delete query would be like,
DELETE FROM employee WHERE id = 100;
Asked In: Many Interviews |
Alert Moderator