mysql copy table structure code example
Example 1: mysql copy table with new name
CREATE TABLE IF NOT EXISTS new_table LIKE existing_table;
INSERT new_table
SELECT * FROM existing_table;
Example 2: mysql copy table to another table
CREATE TABLE new_table
SELECT col1, col2, col3
FROM
existing_table
WHERE
conditions;
Example 3: clone table structure mysql
CREATE TABLE foo SELECT * FROM bar LIMIT 0
Or
CREATE TABLE foo SELECT * FROM bar WHERE 1=0