DELETE Statement

Deletes all the rows from the named table that satisfy the search condition. If no WHERE clause is specified, all rows from the named table are deleted.

Quick Links:

Go to Parameters

Go to Examples

Go to Usage

Go to Standards

Go to Permissions

Syntax

DELETEFROM ] [ owner.]table-name [[AS correlation-name]
   ...[ FROM table-expression ] 
   [ WHERE search-condition ]]

table-expression
   table-spec 
   | table-expression join-type table-specON condition ] 
   | table-expression, ...

Parameters

(back to top)

Examples

(back to top)

Usage

(back to top)

DELETE can be used on views provided the SELECT statement defining the view has only one table in the FROM clause and does not contain a GROUP BY clause, an aggregate function, or involve a UNION operation.

If the same table name from which you are deleting rows is used in both FROM clauses, they are considered to reference the same table if one of the following is true:
  • Both table references are not qualified by specifying a user ID
  • Both table references are qualified by specifying a user ID
  • Both table references are specified with a correlation name
In cases where the server cannot determine if the table references are identical, an error appears. This prevents the user from unintended semantics by deleting unintended rows.

Standards

(back to top)

  • SQL—Vendor extension to ISO/ANSI SQL grammar.
  • SAP Sybase Database product—Supported by Adaptive Server, including the vendor extension.

Permissions

(back to top)

Requires DELETE privilege on the table.

Related concepts
Row Limitation Clauses in SELECT Query Blocks
Related reference
FROM Clause
INSERT Statement
TRUNCATE Statement