Deletes a set of rows from a table or view.
All rows in the set defined by the
WHEREclause are deleted from the base table or view identified by
table-name. If no
WHEREclause is specified, all rows are deleted.
table-nameidentifies a view rather than a base table, entire rows, including columns invisible from the view, are deleted from the base table on which the view is defined. For a delete to be performed on a view, the view must be updatable, see CREATE VIEW.
NOT FOUNDcondition code is returned if no row is deleted, see Return Status and Conditions.
search-condition, see Search Conditions.
DELETEprivilege must be held on the table or view identified by
In a procedural usage context, the
DELETEstatement is only permitted if the procedure
MODIFIES SQL DATA, see CREATE PROCEDURE.
correlation-nameis specified after the table name in the
DELETE FROMclause, the correlation name must be used to refer to the table in the
WHEREclause of the
If the table name addressed by the
DELETEstatement is subject to any referential constraints, the delete operation must not create a situation where these constraints are violated. The effect of the delete operation on any referential constraints depends on the
delete-rulein effect for each constraint, see CREATE TABLE for a description of the
DELETEstatement is executed as a single statement. If an error occurs at any point during the execution, none of the rows in the set defined by the
WHEREclause will be deleted (however, if the table is stored in a databank with the
WORKoption it is possible that some rows will be deleted).
ExampleDELETE FROM countries WHERE CITY = 'Dublin';
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40