Remove rows from a table.
Removes rows from a table, optionally filtered by WHERE. Without WHERE, all rows are deleted (triggers fire per row in some databases). Use OUTPUT/RETURNING to capture deleted data before it is gone.
Compatibility
| Database System | Support Status | Since Version | Notes |
|---|---|---|---|
| MySQL | Native | all | Standard |
| PostgreSQL | Native | all | Standard |
| SQL Server | Native | all | Standard + OUTPUT |
| Oracle | Native | all | Standard + RETURNING |
| SQLite | Native | all | Standard |
Details
Basic DML for removing rows.
Standard Syntax
DELETE FROM table_name
WHERE condition;
Version Support
MySQL: Native in all listed versions
PostgreSQL: Native in all listed versions
SQL Server: Native in all listed versions
Oracle: Native in all listed versions
SQLite: Native in all listed versions
Per-Database Syntax & Notes
MySQL Native syntax
Standard
DELETE FROM tbl WHERE …;
PostgreSQL Native syntax
Standard
DELETE FROM tbl WHERE … RETURNING *;
SQL Server Native syntax
Standard + OUTPUT
DELETE FROM tbl
OUTPUT deleted.*
WHERE …;
Oracle Native syntax
Standard + RETURNING
DELETE FROM tbl WHERE … RETURNING * INTO …;
SQLite Native syntax
Standard
DELETE FROM tbl WHERE …;