Deleting Rows from Tables
The DELETE statement removes rows from a table, and has the general form:DELETE FROM table [WHERE search-condition];
The search condition specifies which rows in the table are to be deleted. If no search condition is specified, all rows will be deleted (the table is emptied but not dropped).
Delete all countries that begin with the letter 'D' from the COUNTRIES table:DELETE FROM countries WHERE country LIKE 'D%';
Delete all rows from the CUSTOMERS table:DELETE FROM customers;
Delete all Sony items:DELETE FROM mimer_store.items WHERE producer_id = (SELECT producer_id FROM mimer_store.producers WHERE producer = 'Sony');
When a subselect is used in the search condition, the table from which rows are deleted may not be used in the subselect.
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40