Skip to main content

DELETE Statement

To delete rows from a table you use the SQL DELETE command:

DELETE

FROM tablename

[WHERE condition];

The WHERE condition is optional but, if omitted, all the rows in the table are deleted. Normally, this is not desired. It is a very common mistake, so take care when using this command. For example:

Delete all employees called Smith from the pensions section:

DELETE

FROM employee

WHERE surname = 'Smith' AND section_name = 'Pensions';

Next: Activity 2.6