SQL creates a new table from an existing table, the new table structure is the same as the existing table structure, but not the data in the existing table!
The execution of DML statements depends on the database type:
SQLITE-----Copy table structure and data to the new table create table Table_new as SELECT * from table_old;-----Copy table structure only to new table CREATE TABLE table_new as SELECT * F ROM table_old WHERE 1=0;oracle:-----Copy table structure and data to new table CREATE table T_new as SELECT * from Table_old; -----Copy only the table structure to the new table create table T_new as SELECT * from Table_old WHERE 1=0; MYSQL:-----Copy table structure and data to a new table CREATE TABLE t_new SELECT * FROM t_old-----Copy table structure only to new table CREATE TABLE t_new SELECT * from T_old WHERE 1=2 ---No db instance, find data DB2:-----Copy table structure and data to new table CREATE table Table_name_new as (SELECT * from Table_name_old) DEFINITION only;-- Inserting data insert INTO t_new (SELECT * from Table_name_old); SQL Server:-----Copy table structure and data to new table select * into t_new from t_old;-----Copy table structure only to new table SELECT * to T_new from T_old WHERE 1=2;
SQL to create a new table from an existing table