Skip to main content

DELETE

Remove rows from a table.

Syntax

Parameters

ParameterDescription
tableThe table to delete rows from
WHERE conditionFilter which rows to delete. Without WHERE, all rows are removed

Examples

Delete with condition

DELETE FROM sessions
WHERE expires_at < NOW();

Delete matching a subquery

DELETE FROM orders
WHERE customer_id IN (
SELECT id FROM customers WHERE active = FALSE
);

Delete all rows

DELETE FROM temp_results;

See also