重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

【实验】验证通过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://cqcxhl.cn/article/jojjid.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP