The DELETE statement deletes one or more rows from a table.
Invocation
This statement can be used in an application program using the CLI functions or issued through the CLP.
Syntax
>>-DELETE FROM--table-name--+-----------------------------+---->< '-WHERE--| search_condition |-' search_condition: .----------------------------------------------. V | |----+------------------------------------------+-+-------------| '-+-AND-+--+-----+--+-| predicate |------+-' '-OR--' '-NOT-' '-(search_condition)-' predicate: |--+-| basic predicate |-+--------------------------------------| +-| IN predicate |----+ +-| LIKE predicate |--+ '-| NULL predicate |--' basic predicate: |--| expression |--+-=--+--| expression |-----------------------| +-<>-+ +-<--+ +->--+ +-<=-+ +->=-+ '-||-' IN predicate: .-,--------------------. V | |--| expression |--+-----+--IN----(--| expression |--)-+--------| '-NOT-' LIKE predicate: |--| expression |--+-----+--LIKE--| expression |----------------| '-NOT-' NULL predicate: (1) |--| expression |-------IS--+-----+--NULL-----------------------| '-NOT-' expression: .-operator--------------------. V | |----+---+--+-literal----------+-+------------------------------| +-+-+ +-column-name------+ '---' +-(expression)-----+ +-special register-+ '-function---------' operator: |--+-/-+--------------------------------------------------------| +-*-+ +-+-+ '---'
Anmerkungen:
Description
The result of a search_condition is derived by applying the specified logical operators (AND, OR, NOT) to the result of each specified predicate. A predicate compares two values. If logical operators are not specified, the result of the search condition is the result of the specified predicate.
Search conditions within parentheses are evaluated first. If the order of evaluation is not specified by parentheses, NOT is applied before AND, and AND is applied before OR. The order in which operators at the same precedence level are evaluated is undefined to allow for optimization of search conditions.
The search_condition is applied to each row of the table and the deleted rows are those for which the result of the search_condition is true.
Each column-name in the search condition must identify a column of the table.
Arithmetic operations on BLOB(n), DATE, TIME, and TIMESTAMP data types are not supported.
Rules
None.
Example
Delete employee number (EMPNO) 003002 from the EMPLOYEE table.
DELETE FROM EMPLOYEE WHERE EMPNO = '003002'
Zugehörige Referenzen