Renaming a table can be done in a single command:
RENAME TABLE `<old name>` TO `<new name>`;
The following syntax does exactly the same:
ALTER TABLE `<old name>` RENAME TO `<new name>`;
If renaming a temporary table, the ALTER TABLE
version of the syntax must be used.
Steps:
<old name>
and <new name>
in the line above with the relevant values. Note: If the table is being moved to a different database, the dbname
.tablename
syntax can be used for <old name>
and/or <new name>
.