Sometimes we need to copy a table from MySQL database to another one, whether because of a backup or building another, similar table, or any another reason. When a table has to be cloned for applications, as mentioned, such as backing up data or replicating of data for testing... etc, we can do it using CREATE TABLE and SELECT statements.

To clone a table, we first create a clone table and then give the contents to be copied to that same table. The example below shows the procedure:

CREATE TABLE new_table;

SELECT * FROM existing_table;

For example to create a clone of the table 'tblstudents' and copy all of its contents, we may do:

CREATE TABLE clonestudents;

SELECT * FROM tblstudents;

In another example, to selectively copy few columns into the cloning table we can use WHERE conditions, as given here:

CREATE TABLE clonemarks;

SELECT * FROM tblstudents;

WHERE verdict LIKE 'Fail';