DELETE

DELETE deletes rows in the specified table that meet the search condition. The basic syntax for the DELETE statement involves simple search conditions which may delete zero to many rows from the table.

DELETE FROM table_name [WHERE column_name operator {column_name|constant}]
   operator ::=
      + | - | * | / | string concatenation(||)

Example

DELETE FROM cust WHERE id = 123

Omitting the WHERE clause means that all rows in the table are deleted.

More advanced search conditions can be included in the DELETE statement using the syntax below.

DELETE FROM table_name [WHERE search_condition] 

   search_condition ::=
      [NOT] conditional_expression [{AND|OR} [NOT] conditional_expression...] 

   conditional_expression ::=

      expression operator {term|USER}
      | expression operator {ALL|ANY|SOME} (select_statement)
      | expression [NOT] BETWEEN expression AND expression
      | expression [NOT] IN ({select_statement | value [, value...]})
      | expression [NOT] LIKE value [ESCAPE value]
      | column_name IS [NOT] NULL
      | EXISTS (select_statement) 

   expression ::=
      term [operator {term|expression}] 

   operator ::=
      + | - | * | / | string concatenation(||) 

   term ::=
      [[account.]table_name.]column_name | constant

Example

DELETE FROM cust WHERE age BETWEEN 18 and 24