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 .. RENAME COLUMN

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

Like most object types, columns can be renamed:

// Rename a column
create.alterTable("table").renameColumn("old_column").to("new_column").execute();

Dialect support

This example using jOOQ:

alterTable("t").renameColumn("c").to("d")

Translates to the following dialect specific expressions:

Access, Aurora MySQL, Aurora Postgres, BigQuery, ClickHouse, CockroachDB, DB2, DuckDB, Exasol, MariaDB, MySQL, Oracle, Postgres, Redshift, SQLDataWarehouse, SQLite, Snowflake, Trino, Vertica, YugabyteDB

ALTER TABLE t RENAME COLUMN c TO d

ASE

EXEC sp_rename 't.c', d, 'column'

Derby, Hana, Informix

RENAME COLUMN c TO d

Firebird

ALTER TABLE t ALTER COLUMN c TO d

H2, HSQLDB

ALTER TABLE t ALTER COLUMN c RENAME TO d

MemSQL

ALTER TABLE t CHANGE c d

SQLServer

EXEC sp_rename 't.c', d, 'COLUMN'

Sybase, Teradata

ALTER TABLE t RENAME c TO d
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