Search Shortcut cmd + k | ctrl + k
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’s support for VACUUM is limited to vacuuming entire row groups.

About this page

Last modified: 2024-03-02