Oracle OCP认证-Oracle OCM认证

您当前的位置:优技教育 > ocp考试 >

ocp 11g认证考试051题库解析:第34题

来源:优技教育

ocp 11g认证考试051题库解析:第34题,完整题库请点击这里联系老师咨询了解

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.

Answer: D

答案解析:

A. 一个列上不能有两个约束,错误,例如非空+唯一可以作用在一个列上。

B. 如果数据已经存在不能添加主键约束,错误,有数据存在,也可以插入主键约束,前提是数据没有重复

C. 主键约束只有在表创建时才能被创建,错误。有了数据之后一样可以增加,不一定只有在创建的时候加

D. 即使数据存在,如果没有重复值,你能添加主键约束,正确。

精华阅读