Skip to main content
2 of 3
edited tags
Paul White
  • 90.3k
  • 30
  • 424
  • 663

What is the standard SQL way to rename a column?

So far I've seen ALTER TABLE RENAME, ALTER TABLE CHANGE and ALTER TABLE MODIFY.

What I'm trying to achieve is something like ALTER TABLE my_table RENAME col_old_name TO col_new_name, which can be a case of modifying a column.

SQLite goes with RENAME.
MariaDB and MySQL have all three.
Postgres goes with RENAME.
Oracle has RENAME and MODIFY.
Standards are unkown to SQL Server.

What is the database-agnostic way for renaming (or generally altering) a column?

vesperto
  • 125
  • 1
  • 2
  • 8