How to Delete

The delete SQL statement allows us to remove existing records from a table. We need to specify what are the records to delete by using a where clause. Caution, if you omit the where clause, all the records in the table will be deleted!

-- John Smith is fired
delete from employee where last_name = ‘Smith’ and first_name = ‘John’;

-- Oh no!, we forgot the where and we lost all the records of the table employee
delete from employee;

IN THIS PAGE