使用子查询创建表(oracle)

转自:https://blog.csdn.net/lxh123456789asd/article/details/81164321

语句:

    CREATE TABLE tablename[(column1,column2,column3.....]

                                                  AS subquery;

例子:

   1.create table tabletest as select * from emp where 1=2;

这句话后面的where条件为假,表示只复制表的结构,而不复制数据,当where表后面的条件为真的时候,表示结构和表都复制过去。

    2.create table emp20

      as

      select * from emp where deptno=20;

这句话表示会将表的结构以及部门为20号的员工的信息复制过来。


---------------------
作者:短腿哥哥
来源:CSDN
原文:https://blog.csdn.net/lxh123456789asd/article/details/81164321
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自www.cnblogs.com/sharpest/p/10508335.html