Learn how to use the SQL RENAME TABLE Statement with the explained examples in this tutorial. Change single or multiple table name using SQL RENAME TABLE statement, you have to specify the old and new table name.

You have to use the ALTER table statement inside which you can use the RENAME TABLE statement. If you rename the table name, the columns of the table remain same and will not change until you change them.

Only the table name will change and the number of columns and the data does not change.

How to Use SQL RENAME TABLE Statement to Change Table Name

To use the RENAME statement, you need to specify the old table name and the new table name. Use the meaningful new table name to easily find it from the other tables.

ALTER TABLE Statement to Change the Name

To change the name of the table, you have to use both the ALTER statement and the RENAME statement. Also, specify the name of the old table and the new table names.

Change Table Name using SQL RENAME TABLE Statement

You can change the name of the table using the rename statement and the old name and the new name of the table.

Rename Multiple Tables Name using SQL RENAME TABLE Statement

In addition to all the above, you can change multiple table names by the single syntax. Specify the multiple table names using the TO statement as given below.

The description of the parameters is given below. However, there are only two parameters and you can easily find the meaning of these parameters.

Parameter use in the syntax

Sr. No. Parameter Name Sr. No.
1 old_tablename Specify the current table name of the table whose name you want to change.
2 new_tablename Enter your new chosen table name to which you want to change the current table name.

Let’s create examples using the syntax above.

Examples to Use SQL Rename Table Statement

There are two examples given below to understand the renaming of the table. However, you can easily understand the use with just the first example given below.

The above example changed the name of the table from Employee to Company.



You must also learn.