Using TRUNCATE, we cannot restore the deleted data.
TRUNCATE TABLE table_name;
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.
DELETE FROM table_name [WHERE condition];
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 |