mysql/oracle中create table as的用法

来源:互联网 发布:linux查看jdk版本 编辑:程序博客网 时间:2024/06/17 12:31

1 mysql

create table t2 as select c1 from t1;   --正确,一般用法--新表中对列重命名create table t2 as select c1 c2 from t1;    --正确create table t2(c2 varchar(50)) as select c1 from t1;   --语法正确,但不是预期结果desc t2;    --c1, c2create table t2(c2) as select c1 from t1;       --错误

2 oracle

create table t2 as select c1 from t1;   --正确,一般用法--新表中对列重命名create table t2 as select c1 c2 from t1;    --正确create table t2(c2) as select c1 from t1;       --正确desc t2;    --c2create table t1(col1 varchar(255)) as select c1 from t1;    --错误,不能指定数据类型

3 insert into select和select into from

--oracle和mysql都不支持select into from,都支持insert into select
原创粉丝点击