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

ALTER TABLE .. DROP COLUMNS

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

Multiple columns can be dropped from a table using the ALTER TABLE's DROP COLUMNS clause:

// Drop several columns in one go
create.alterTable("table").drop("column1", "column2").execute();

Dialect support

This example using jOOQ:

alterTable("t").drop("c1", "c2")

Translates to the following dialect specific expressions:

ASE

ALTER TABLE t DROP c1, c2 WITH NO DATACOPY

Aurora MySQL, Aurora Postgres, CockroachDB, Firebird, MariaDB, MemSQL, MySQL, Postgres, Teradata, YugabyteDB

ALTER TABLE t DROP c1, DROP c2

BigQuery, ClickHouse

ALTER TABLE t DROP COLUMN c1, DROP COLUMN c2

DB2

ALTER TABLE t DROP c1 DROP c2

H2, Snowflake

ALTER TABLE t DROP c1, c2

Hana, Informix, Oracle

ALTER TABLE t DROP (c1, c2)

SQLDataWarehouse, SQLServer

ALTER TABLE t DROP COLUMN c1, c2

Access, Derby, DuckDB, Exasol, HSQLDB, Redshift, SQLite, Sybase, 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