SQL Rename Table

SQL RENAME TABLE statement is used for renaming the table.

As we already discussed the syntax for renaming the column using ALTER:

ALTER TABLE table_name
RENAME to new_table_name;

 

                                                  Or

You can generally use the following syntax

RENAME old_table_name to new_table_name;

 

Example:

Now we take the Student table and we want to change the Student table to Employees.

StudentID Student_Name Address City
1 Nithin Bank Street Hyderabad
2 Bharath Panama Street California

 

To change the name of the table you should use any of the following syntaxes

RENAME Student to Employees;

                                                                          Or

ALTER TABLE Student
RENAME to Employees;

 

Now to Access the table you should provide new table name to which it changes i.e., Employees