DELETE
Removes rows from an existing table.
Synopsis
Description
The DELETE
command removes rows from a specified table. The deletion can be specific by using the WHERE
clause to identify the needed rows to delete. Without the WHERE
clause, the command removes all the rows in the table and leaves it empty.
Parameters
table_name
The name of the table to delete rows from.
alias
A substitute alias name for table_name
. The alias name should match the Identifiers Limitations.
WHERE
The condition to filter the rows for deletion. If this parameter is omitted, all the rows in the table are removed.
The WHERE
clause can contain the rows ROWID
with = or IN
condition.
RETURNING output_expression
Returns the given expression for every row deleted by the command. Refer to the expression parameter of SELECT for specification of the output_expression parameter.
Outputs
On successful completion, the DELETE
command returns the count of the deleted rows.
Examples
Delete rows based on a specific filter:
Delete rows based on another table filter:
Delete a row based on its ROWID:
Compatibility
The DELETE
command conforms to the SQL standard with the exception of the RETURNING
functionality.