How to change a table name in SQL ?

DatabaseSQL

This is the command to change a table name in SQL:


ALTER TABLE table_name
RENAME TO new_table_name;

We will start off by giving the keywords ALTER TABLE, then we will follow it up by giving the original name of the table, after that, we will give in the keywords RENAME TO and finally, we will give the new table name.

For example, if we want to change the “employee” table to “employee_information”, this will be the command:


ALTER TABLE employee
RENAME TO employee_information;
     

Advertisements

ads