MySQL Rename Table


The RENAME TABLE syntax can be used to rename one or more tables.

RENAME TABLE tb_name TO new_tb_name, tb_name2 TO new_tb_name2, ...

The rename operation is done automatically, which means that other threads can not read any tables while renaming is running.

If you want to exchange the names of two tables, you can do the following (assuming there is no table named tmp_table):

RENAME TABLE old_table TO tmp_table,
             new_table TO old_table,
             tmp_table TO new_table



Copyright 2014-2017 by DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook