Changing the name of an existing table or column without recreating the object.
Renames a table atomically without moving data. Views and foreign key references to the table may need updating. Most databases support this; the syntax varies (RENAME TABLE in MySQL, ALTER TABLE ... RENAME TO in PostgreSQL).
| Database System | Support Status | Since Version | Notes |
|---|---|---|---|
| MySQL | ✓ Supported | 5.0 | RENAME TABLE (table) since 5.0. RENAME COLUMN (column) added in 8.0. On older versions use CHANGE col old_col new_col col_definition. |
| PostgreSQL | ✓ Supported | 7.4 | Both RENAME TABLE and RENAME COLUMN are via ALTER TABLE. Renaming updates pg_class/pg_attribute metadata instantly with no table rewrite. |
| SQL Server | ✓ Supported | 2000 | Uses sp_rename system procedure rather than ALTER TABLE syntax. Views, procedures, and other objects that reference the old name are not automatically updated. |
| Oracle | ✓ Supported | 9i | RENAME (table) is standalone DDL; column rename via ALTER TABLE RENAME COLUMN added in Oracle 9i. Dependent objects (views, procedures) are invalidated and must be recompiled. |
| SQLite | ✓ Supported | 3.25.0 | ALTER TABLE RENAME TO (table rename) has been available since very early SQLite. RENAME COLUMN was added in 3.25.0 (2018). Views and triggers referencing the old column name are updated automatically. |
Table and column renaming is universally supported but the syntax diverges meaningfully. SQL Server's sp_rename is the odd one out — it's a procedure call, not DDL syntax, and critically it does not update references in views, stored procedures, or computed columns. Always run sp_depends or search sys.sql_modules after renaming in SQL Server. Oracle invalidates dependent objects on rename but will revalidate automatically the next time they are accessed if the new name resolves. MySQL's CHANGE syntax for pre-8.0 column renames requires repeating the full column definition, making it error-prone. PostgreSQL and SQLite have the cleanest behavior: standard ALTER TABLE syntax, no object rewrite, and (SQLite 3.25+) automatic reference updates in views and triggers.
RENAME TABLE (table) since 5.0. RENAME COLUMN (column) added in 8.0. On older versions use CHANGE col old_col new_col col_definition.
Both RENAME TABLE and RENAME COLUMN are via ALTER TABLE. Renaming updates pg_class/pg_attribute metadata instantly with no table rewrite.
Uses sp_rename system procedure rather than ALTER TABLE syntax. Views, procedures, and other objects that reference the old name are not automatically updated.
RENAME (table) is standalone DDL; column rename via ALTER TABLE RENAME COLUMN added in Oracle 9i. Dependent objects (views, procedures) are invalidated and must be recompiled.
ALTER TABLE RENAME TO (table rename) has been available since very early SQLite. RENAME COLUMN was added in 3.25.0 (2018). Views and triggers referencing the old column name are updated automatically.