To rename a table in MySQL you need to execute the following command:
RENAME TABLE old_table_name TO new_table_name;
The old_table_name must exist n the database and the new_table_name must not. For example, we have a table name demo and we want to change its name as demo1. So we will execute the following MySQL statement to rename it:
RENAME TABLE demo TO demo1
You can also rename multiple tables using RENAME TABLE statement in MySQL as follows:
RENAME TABLE old_table_name_1 TO new_table_name_2,
old_table_name_2 TO new_table_name_2,...
0 Comment(s)