看你用的什么数据库:
Sql server :
select * into table_new from table_old ; 复制结构和数据
select * into table_new from table_old where 1=2;只复制结构
Oracle:
create table table_new as select * from table_old;复制结构和数据
create table table_new as select * from table_old where 1=0;只复制结构
DB2:
--复制表结构
create table table_name_new as (select * from table_name_old) definition only;
--插入数据
insert into table_name_new (select * from table_name_old);
MySql:
----- 复制表结构及数据到新表
CREATE TABLE 新表 SELECT * FROM 旧表
----- 只复制表结构到新表
CREATE TABLE 新表 SELECT * FROM 旧表 WHERE 1=2
//复制了表student 的表结构到 studets中了
select top 0 * into studets from student
SQLSERVER:select * into b from a where 1 <> 1 或者select top 0 * into b from a
a是原表,b是现有表。
ORACLE:create table b as select * from a where 1 <> 1
create table newtable as
select * from oldtable where 1=2