Home / SQL / Reference / Changing data

SQL DELETE

Remove rows.

Syntax

DELETE FROM t WHERE condition;

Without WHERE, every row is removed (the table stays).

Example

Query (on the shop database used in the SQL course)

DELETE FROM order_items WHERE quantity = 3;
SELECT COUNT(*) AS items_left FROM order_items;

Result

items_left
79

1 row

Related

Learn it step by step in the free lesson Changing Data, with exercises that check your queries.