Search Shortcut cmd + k | ctrl + k
Search cmd+k ctrl+k
1.0 (stable)
DELETE Statement

The DELETE statement removes rows from the table identified by the table-name.

Examples

Remove the rows matching the condition i = 2 from the database:

DELETE FROM tbl WHERE i = 2;

Delete all rows in the table tbl:

DELETE FROM tbl;

The TRUNCATE statement removes all rows from a table, acting as an alias for DELETE FROM without a WHERE clause:

TRUNCATE tbl;

Syntax

The DELETE statement removes rows from the table identified by the table-name.

If the WHERE clause is not present, all records in the table are deleted. If a WHERE clause is supplied, then only those rows for which the WHERE clause results in true are deleted. Rows for which the expression is false or NULL are retained.

The USING clause allows deleting based on the content of other tables or subqueries.

Limitations on Reclaiming Memory and Disk Space

Running DELETE does not mean space is reclaimed. In general, rows are only marked as deleted. DuckDB reclaims space upon performing a CHECKPOINT. VACUUM currently does not reclaim space.

About this page

Last modified: 2024-06-21