MySQL Copying a Table
Copying a Table
To copy the structure and data from one table to another, you can use the CREATE TABLE ... SELECT
statement:
Syntax:
CREATE TABLE new_table_name AS
SELECT * FROM existing_table_name;
Example:
CREATE TABLE employees_backup AS
SELECT * FROM employees;
This creates a new table employees_backup
with the same structure and data as employees
.