Skip to main content
Deletes rows from the specified table.

Syntax

Parameters

The DELETE FROM <table> without <expression> will delete all rows from the table. It is equivalent to a TRUNCATE TABLE statement.

Remarks

Deleted rows are marked for deletion, but are not automatically cleaned up. You can monitor fragmentation in information_schema.tables to understand how many rows are marked for deletion out of total rows; fragmentation = (rows marked for deletion / total rows). Total row count in information_schema.tables excludes the number of rows marked for deletion. Query performance is not materially impacted by delete marks. To mitigate fragmentation, use the VACUUM command to manually clean up deleted rows.

Example

The following example deletes entries from the products table where the quantity is less than 10:
Table before: Table after:

Example specifying other tables in the USING clause

This example deletes all the products from stores that went out of business.
Table products before: Table suppliers before: Table products after: