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

ALTER TABLE .. DROP UNIQUE

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

A UNIQUE constraint can be dropped from the table using the ALTER TABLE's DROP UNIQUE clause:

// Drop specific types of constraints
create.alterTable("table").dropUnique("uk").execute();

Dialect support

This example using jOOQ:

alterTable("t").dropUnique("c")

Translates to the following dialect specific expressions:

ASE, Access, Aurora MySQL, Aurora Postgres, DB2, Derby, Firebird, H2, HSQLDB, Hana, Informix, MariaDB, MySQL, Oracle, Postgres, Redshift, SQLDataWarehouse, SQLServer, Snowflake, Sybase, Teradata, Vertica, YugabyteDB

ALTER TABLE t DROP CONSTRAINT c

CockroachDB

DROP INDEX c CASCADE

BigQuery, ClickHouse, DuckDB, Exasol, MemSQL, SQLite, Trino

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

References to this page

Feedback

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

The jOOQ Logo