contact subscribe

Duplicating a MySQL Table.

Here’s a maxim worth remembering when you feel the itch to run queries on a production database table:

Duplicate the table you want to play with.

The MySQL syntax for this command is simple:

CREATE TABLE duplicate SELECT * FROM live

For large data-sets, you may want to limit the size of the test table:

CREATE TABLE duplicate 
SELECT * FROM live WHERE field1='value' LIMIT 0, 10000;

Post Your Comment




Remember Me?