ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【实验】验证通过create table as select 方式无法创建主键小实验

【实验】验证通过create table as select 方式无法创建主键小实验

Linux操作系统 作者:Thinkbase 时间:2017-05-03 23:12:58 0 删除 编辑
sec@ora10g> create table test1 ( a number primary key, b number not null);

Table created.

sec@ora10g> desc test1;
 Name                   Null?    Type
 ---------------------- -------- ------------------
 A                      NOT NULL NUMBER
 B                      NOT NULL NUMBER

sec@ora10g> insert into test1 values (1,1);

1 row created.

sec@ora10g> insert into test1 values (2,2);

1 row created.

sec@ora10g> COMMIT;

Commit complete.

sec@ora10g> create table test2 as select * from test1;

Table created.

sec@ora10g> desc test2;
 Name                  Null?    Type
 --------------------- -------- ------------------
 A                              NUMBER
 B                     NOT NULL NUMBER

sec@ora10g> select * from test1;

         A          B
---------- ----------
         1          1
         2          2

sec@ora10g> select * from test2;

         A          B
---------- ----------
         1          1
         2          2

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31457562/viewspace-2138381/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2017-05-03

  • 博文量
    12
  • 访问量
    10969