Sometimes, we need to move a table from one database to another database, but MySQL doesn’t provide a command named ‘move’. So how can we do that?
Fortunately, it seems an easily solved problem. After simply search google, we find the answer quickly. The answer is to use the “alter” command. The “alter” statement could not only rename or modify a column for a table, it could move a table to another database as well.
So, we can use the alter statement with the rename action to do this by specifying the origin database name and destination database name on the table name. The code would be like the following: