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。
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。
相关文章推荐
- OCP 1Z0 051 QUESTION NO: 34
- 1Z0-051 QUESTION 35 Primary key和foreign key的用法
- OCP 1Z0 051 QUESTION NO: 4
- OCP 1Z0 051 QUESTION NO: 17
- OCP 1Z0 051 QUESTION NO: 18
- OCP 1Z0 051 QUESTION NO: 28
- OCP 1Z0 051 QUESTION NO: 32
- 1Z0-051 QUESTION 36 create table中约束应注意的地方
- OCP-1Z0-051-V9.02-34题
- OCP 1Z0 051 QUESTION NO: 5
- OCP 1Z0 051 QUESTION NO: 29
- OCP 1Z0 051 QUESTION NO: 33
- ORACLE中通过SQL语句(alter table)来增加、删除、修改字段
- 1Z0-051 QUESTION 11 运算顺序
- 1Z0-051 QUESTION 14 DISTINCT的用法
- 1Z0-051 QUESTION 23 数据类型应该注意的地方
- 1Z0-051 QUESTION 37 关于drop table
- ORACLE中通过SQL语句(alter table)来增加、删除、修改字段 ,增加字段与修改字段
- OCP 1Z0 051 QUESTION NO: 19
- OCP 1Z0 051 QUESTION NO: 39