Wednesday, January 20, 2010

Copy a table in MySQL

Use structure CREATE TABLE new_table LIKE old_table

The following queries copy table vtiger_account in vtigerCRM
First, create an empty table with the same structure
CREATE TABLE vtiger_account_bk LIKE vtiger_account;

Second, copy data
INSERT INTO vtiger_account_bk SELECT * FROM vtiger_account;

No comments:

Post a Comment