DELETE

On this page

Removes rows from a table. WHERE limits the affected rows; without it, every row is deleted. The table definition remains available for future inserts.

Syntax

DELETE FROM <table_name>
[ WHERE <predicate> ]

Examples

Create a sample table with both real and test events:

CREATE TABLE event_cleanup (event_id string, is_test boolean)
VALUES ('evt-17', FALSE), ('test-42', TRUE)
INSERT INTO event_cleanup

Remove the test event:

DELETE FROM event_cleanup WHERE is_test = TRUE
FROM event_cleanup
ORDER BY event_id
+----------+---------+
| event_id | is_test |
+----------+---------+
| evt-17   | false   |
+----------+---------+