1. Copy the referenced table:
CREATE TABLE clone_product_1 like product_1;
INSERT into Clone_product_1 SELECT * from product_1;
2. Copy the reference table:
1. Get the complete structure of the data table.
2. Modify the data table name of the SQL statement and execute the SQL statement.
CREATE TABLE ' Clone_product_attribute_1 ' (
' id ' int (one) not NULL auto_increment,
' product_id ' int (one) is not NULL,
' variation_id ' varchar not NULL DEFAULT ' ',
' Price ' Double is not NULL,
' Quantity ' int (one) not NULL DEFAULT ' 0 ',
' Reviews ' int (one) not NULL DEFAULT ' 0 ',
' Image ' Longtext not NULL,
' Attributes ' varchar (+) not NULL DEFAULT ' {} ',
' dictory ' varchar (+) not NULL DEFAULT ' ',
' Create_date ' datetime not NULL,
' Write_date ' datetime not NULL,
PRIMARY KEY (' id '),
KEY ' clone_product_attribute_1 ' (' product_id '),
CONSTRAINT ' Product_id_attribute_1 ' FOREIGN KEY (' product_id ') REFERENCES ' clone_product_1 ' (' ID ')
) Engine=innodb DEFAULT Charset=utf8;
INSERT INTO Clone_product_attribute_1 select * from Product_attribute_1;
Replication of MySQL Association tables