Oracle Rename Column Using ALTER Query & Rename Table Example
In Oracle, to rename a column in a table, use ALTER TABLE RENAME COLUMN statement.
On this page
Oracle Rename Column table syntax:
- To rename a column in oracle we have to use rename column statement
- You have to use rename column statement along with alter table statement
- The RENAME COLUMN statement allows us to rename an existing column in an existing table in any schema (except the schema SYS).
ALTER TABLE table_name RENAME COLUMN old_column_name TO new_column_name;
For example, we have an employee table which contains columns as id,name,email,date_hired and job columns
We will rename the email column to email_id
create table employees ( id number not null, name varchar2(50) not null, email varchar2(255), date_hired date, job varchar2(255) )
Oracle Rename Column in a table query example
To rename a column in oracle table use the below query
ALTER TABLE employees RENAME COLUMN email TO email_id;
Oracle Rename table name syntax:
To rename a table name in oracle use following query syntax
RENAME TABLE_NAME to NEW_TABLE_NAME:
Oracle Rename table query example:
The below query renames the table name employees to new table name
RENAME employees to emp;
To rename a column name or table name, you must be the database owner or the table owner.