Available in versions: (可用版本:) Dev (3.21) | Latest (3.20) (最新版 (3.20)) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11

ALTER TABLE .. DROP CONSTRAINT (修改表 .. 删除约束)

适用于 ✅ 开源版   ✅ 专业版   ✅ 企业版

A constraint can be dropped from the table using the ALTER TABLE's DROP CONSTRAINT clause (可以使用 ALTER TABLEDROP CONSTRAINT 子句从表中删除约束)

// Drop a constraint
create.alterTable("table").dropConstraint("uk").execute();

Alternative syntaxes are available to restrict dropping only to specific types of constraints (有其他语法可用于限制仅删除特定类型的约束)

方言支持

此示例使用 jOOQ

alterTable("t").dropConstraint("c")

翻译成以下特定方言的表达式

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

ALTER TABLE t DROP CONSTRAINT c

BigQuery, ClickHouse

ALTER TABLE t DROP PRIMARY KEY

Aurora MySQL, DuckDB, MemSQL, MySQL, SQLite, Trino

/* UNSUPPORTED */
使用 jOOQ 3.21 生成。早期 jOOQ 版本的支持可能有所不同。 在我们的网站上翻译您自己的 SQL

反馈

Do you have any feedback about this page? (您对此页面有任何反馈吗?) We'd love to hear it! (我们很乐意听到!)

The jOOQ Logo