⚡ 180+ new openings posted today

SQL RENAME Statement

What is the RENAME Statement in SQL ?

Answer : The RENAME statement is used to change the name of an existing database object, such as a table or column.

Rename a Table

Syntax:

RENAME TABLE old_table_name TO new_table_name;

Suppose we have a table named Employees and want to rename it to Employee_Type:

RENAME TABLE Employees TO Employee_Type;

Now the table name is Employee_Type instead of Employees.

Rename a Column

For databases that support it through ALTER TABLE:

ALTER TABLE Employees
RENAME COLUMN Employee_Name TO Name;

Note: It will not change the existing data; it only changes the name of the existing database.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top