RENAME TABLE table_name TO new_table_name[, table_name2 TO new_table_name2 ...]

Description: Renames a table from table_name to new_table_name.

When multiple tables are being renamed in the same statement, they are read from left to right. It is possible to swap the names of two tables by renaming the first to a temporary name, renaming that to the first table's eventual name after the second table has been renamed.

Description in: Day 6

See also: ALTER TABLE

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.