Remove a table and all its data.

Permanently removes a table and all its data, triggering any associated triggers and constraints. Irreversible. Use CASCADE with caution -- it drops dependent objects too. Prefer soft deletes (is_deleted flag) if you need auditability.

Compatibility

Filter by Database
SQL DROP TABLE Compatibility Across Databases
Database System Support Status Since Version Notes
MySQL Native all CASCADE available
PostgreSQL Native all CASCADE / RESTRICT
SQL Server Native all IF EXISTS in 2016+
Oracle Native all PURGE option
SQLite Native all IF EXISTS

Details

DDL to remove a table.

Standard Syntax

DROP TABLE table_name;

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

CASCADE available

DROP TABLE IF EXISTS tbl;

PostgreSQL Native syntax

CASCADE / RESTRICT

DROP TABLE IF EXISTS tbl CASCADE;

SQL Server Native syntax

IF EXISTS in 2016+

DROP TABLE IF EXISTS tbl;

Oracle Native syntax

PURGE option

DROP TABLE tbl PURGE;

SQLite Native syntax

IF EXISTS

DROP TABLE IF EXISTS tbl;