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).

Compatibility

Filter by Database
SQL RENAME TABLE / COLUMN Compatibility Across Databases
Database System Support Status Since Version Notes
MySQL Native 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 Native 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 Native 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 Native 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 Native 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.

Details

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.

Standard Syntax

-- Table ALTER TABLE old_name RENAME TO new_name; -- Column ALTER TABLE t RENAME COLUMN old_col TO new_col;

Version Support

MySQL: Native since 5.0 PostgreSQL: Native since 7.4 SQL Server: Native since 2000 Oracle: Native since 9i SQLite: Native since 3.25.0

Per-Database Syntax & Notes

MySQL Native syntax

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.

RENAME TABLE old_name TO new_name; -- Column (8.0+): ALTER TABLE t RENAME COLUMN old_col TO new_col; -- Column (pre-8.0): ALTER TABLE t CHANGE old_col new_col INT NOT NULL;

PostgreSQL Native syntax

Both RENAME TABLE and RENAME COLUMN are via ALTER TABLE. Renaming updates pg_class/pg_attribute metadata instantly with no table rewrite.

ALTER TABLE old_name RENAME TO new_name; ALTER TABLE t RENAME COLUMN old_col TO new_col;

SQL Server Native syntax

Uses sp_rename system procedure rather than ALTER TABLE syntax. Views, procedures, and other objects that reference the old name are not automatically updated.

-- Table: EXEC sp_rename 'old_name', 'new_name'; -- Column: EXEC sp_rename 'dbo.t.old_col', 'new_col', 'COLUMN';

Oracle Native syntax

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.

RENAME old_name TO new_name; ALTER TABLE t RENAME COLUMN old_col TO new_col;

SQLite Native syntax

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.

ALTER TABLE old_name RENAME TO new_name; ALTER TABLE t RENAME COLUMN old_col TO new_col;