DELETE is a Data Manipulation Language (DML) statement that permanently removes rows from a table. When a WHERE clause is supplied, only matching rows are deleted; without it, all rows in the target table are removed. The operation obeys transaction rules: changes are visible only after COMMIT and can be undone with ROLLBACK. Foreign-key constraints, ON DELETE triggers, and cascading rules may prevent or propagate deletions. DELETE acquires row or table locks depending on the database, which can affect concurrency. Some dialects (PostgreSQL, SQL Server, SQLite) support a RETURNING / OUTPUT clause to return the deleted rows or specific columns. Large deletes can be batched with ORDER BY and LIMIT/TOP to mitigate locking and log growth. Unlike TRUNCATE, DELETE logs every removed row, fires triggers, and can be filtered.
table_name
(identifier) - Target table holding rows to removesearch_condition
(expression) - Boolean predicate that filters rowssort_expression
(expression) - Column(s) used to order deletions (supported in MySQL, PostgreSQL)row_count
(integer) - Maximum number of rows to delete in this statementcolumn_list
(list) - Columns to return from deleted rows (RETURNING/OUTPUT)TRUNCATE, DROP TABLE, UPDATE, INSERT, MERGE, COMMIT, ROLLBACK, FOREIGN KEY
SQL-92
Every row in the target table is removed. Always double-check your filter conditions or run the statement inside a transaction you can roll back.
Batch the delete with LIMIT/TOP and ORDER BY, disable indexes where safe, increase log file size, or switch to partition exchange/truncate strategies.
No. The sequence continues from its last value. Use TRUNCATE or explicitly reseed the sequence if you need to restart numbering.
Yes. Use a RETURNING/OUTPUT clause, AFTER DELETE triggers, or CDC features to record the affected rows in an audit table or log.