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

来源:互联网 发布:问卷录入软件 编辑:程序博客网 时间:2024/06/05 09:15
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


转载自:点击打开链接

0 0
原创粉丝点击