Removes rows from a table.
DELETE FROM [ ONLY ] table [ WHERE condition ]
table
The name of the table from which you are deleting rows.
condition
The condition that identifies rows to be deleted. This is just like the WHERE
clause of a SELECT
query; refer to the reference
entry titled “SELECT” for more information on constructing conditions. Note that not
providing a WHERE
condition will cause all rows to
be deleted from a table.
Use DELETE
to remove rows from a table. Only rows that match a
condition you specify will be deleted. To delete all rows from a table, do not specify a
condition. Issuing a DELETE
with no condition results in all rows being
deleted from the target table. You will then be left with an empty table.
Use TRUNCATE
to empty a table more efficiently (and explicitly) than
with an unconditional DELETE
statement.
Use the ONLY
clause to prevent the deletion of rows from tables that
inherit from the target table. ONLY
restricts the delete operation to only
the target table. Otherwise, the delete operation will affect not only the target table, but
all tables that inherit from it.