【实验】验证通过createtableasselect方式无法创建主键小实验

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


新闻标题:【实验】验证通过createtableasselect方式无法创建主键小实验
本文来源:http://csdahua.cn/article/jojjid.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流