您的位置:首页 > 产品设计 > UI/UE

1Z0-051 QUESTION 34 通过alter table修改primary key

2014-05-12 00:37 357 查看
34. You created an ORDERS table with the following description: 

name                Null            Type 

ORD_ID              NOT NULL        NUMBER(2) 

CUST_ID             NOT NULL        NUMBER(3) 

ORD_DATE            NOT NULL        DATE 

ORD_AMOUNT          NOT NULL        NUMBER (10,2) 

You  inserted  some  rows  in  the  table.  After  some  time,  you  want  to  alter  the  table  by  creating  the 

PRIMARY KEY constraint on the ORD_ID column. Which statement is true in this scenario? 

A. You cannot have two constraints on one column. 

B. You cannot add a   primary key constraint if data exists in the column. 

C. The primary key constraint can be created only at the time of table creation . 

D. You can add the   primary key constraint even if data exists,   provided that   there are   no duplicate 
values. 

答案为:D

A选项错误,orders表本来没有primary key,所以可以创建primary约束;

B选项错误,如果数据是没有重复的,唯一的,可以创建primary key;

C选项错误,可以通过alter table orders add constraint pk_orders primary key(ird_id);修改表来创建primary key;

D选项正确,存在数据而且没有重复的数据,可以创建primary key。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: