MySQL SELECT * INTO: Copy Table Data and Structure
The 'SELECT * INTO' statement in MySQL is used to create a new table by copying the data and structure of an existing table.
Syntax:
SELECT * INTO new_table_name FROM existing_table_name;
Example:
Suppose we have an existing table 'employees' with columns 'employee_id', 'first_name', 'last_name', and 'salary'. We want to create a new table 'employees_copy' with the same structure and data as the 'employees' table.
The following query can be used to achieve this:
SELECT * INTO employees_copy FROM employees;
This will create a new table 'employees_copy' with the same columns and data as the 'employees' table.
原文地址: https://www.cveoy.top/t/topic/lvEL 著作权归作者所有。请勿转载和采集!