Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10

ALTER TABLE .. DROP COLUMN CASCADE

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

An optional CASCADE clause can be added to a DROP COLUMN clause to cascade the DROP operatoin to dependent objects.

// Add a CASCADE clause when dropping columns
create.alterTable("table").drop("column").cascade().execute();

Note: Implementations do not agree on what dependent objects are included in the CASCADE operation.

Dialect support

This example using jOOQ:

alterTable("t").drop("c").cascade()

Translates to the following dialect specific expressions:

CockroachDB, DB2, Derby, HSQLDB, Postgres, YugabyteDB

ALTER TABLE t DROP c CASCADE

Oracle

ALTER TABLE t DROP COLUMN c CASCADE CONSTRAINTS

ASE, Access, Aurora MySQL, Aurora Postgres, BigQuery, ClickHouse, DuckDB, Exasol, Firebird, H2, Hana, Informix, MariaDB, MemSQL, MySQL, Redshift, SQLDataWarehouse, SQLServer, SQLite, Snowflake, Sybase, Teradata, Trino, Vertica

/* UNSUPPORTED */
Generated with jOOQ 3.20. Translate your own SQL on our website

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo