【实验】验证通过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方式无法创建主键小实验
URL标题:http://lszwz.com/article/jojjid.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款