1.(创建表)create table <table_name>(column1 datatype [not null] [primary key],column2 datatype [not bull],...[constraint<约束名> 约束类型 (要约束的字段)...]);
2.(复制表单不能复制表的约束)create table <table_name> as<select 语句> ;
ex1:create table A as select * from B(复制表A结构及内容至表B);
ex2:create table A as select * from B where 1=2(只复制表A结构至表B不复制数据);
3.(插入数据)insert into <table_name> (column1,column2,...)values(value1,value2,...);
(把一个表中的数据插入另一个表中)
insert into <table_name> <select 语句>
ex:create table A as select * from B where 1=2;insert into A select * from B where sal>2000;