OCP-1Z0-051-2015-17题

Evaluate the followingSQL statements:

Exhibit:

Exhibit:


The above commandfails when executed. What could be the reason?


A. The BETWEEN clause cannot be used for the CHECK constraint
B. SYSDATE cannot be used with the CHECK constraint
C. ORD_NO and ITEM_NO cannot be used as a composite primary key because ORD_NOis also
the FOREIGN KEY
D. The CHECK constraint cannot be placed on columns having the DATE data type

Answer: B
Explanation:

找出建表语句中出错的原因。

B对,sysdate系统时间是变化的,建表时候不能作为约束条件CHECK.

BETWEEN 可以用在check约束中,A错误

A single columncan have multiple CHECK constraints that refer to the column in its definition. 所以C不对。ord_no 可作为主键和外键

check约束可以作用在data类型的列上,D错误。

CHECK Constraint
The CHECK constraint defines a condition that each row must satisfy. Thecondition can use the
same constructs as the query conditions, with the following exceptions:
References to the CURRVAL, NEXTVAL, LEVEL, and ROWNUM pseudocolumns
Calls to SYSDATE, UID, USER, and USERENV functions
Queries that refer to other values in other rows
A single column can have multiple CHECK constraints that refer to the column inits definition.
There is no limit to the number of CHECK constraints that you can define on acolumn.
CHECK constraints can be defined at the column level or table level.
CREATE TABLE employees
(...
salary NUMBER(8,2) CONSTRAINT emp_salary_min
CHECK (salary > 0),

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值