This documentation has been retired and might not be updated. The product, service, or technology mentioned in this content is no longer supported. See DELETE FROM.
DELETE FROM [db_name.]table_name [AS alias] [WHERE predicate]
Delete the rows that match a predicate. When no predicate is provided, delete all rows.
Filter rows by predicate.
WHERE predicate supports subqueries, including
NOT EXISTS, and scalar subqueries. The following types of subqueries are not supported:
Nested subqueries, that is, an subquery inside another subquery
NOT INsubquery inside an
OR, for example,
a = 3 OR b NOT IN (SELECT c from t)
In most cases, you can rewrite
NOT IN subqueries using
NOT EXISTS. We recommend using
NOT EXISTS whenever possible, as
NOT IN subqueries can be slow.