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

xiaoxiao2021-02-27  879

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

转载自:点击打开链接

转载请注明原文地址: https://www.6miu.com/read-620.html

最新回复(0)