中国唯一一家专业只做ARACLE认证和BDA实训的甲骨文金牌合作企业

网络授课

技术沙龙

OCP试题解析:11g-1Z0-051-v9.02-033题

OCP试题解析:11g-1Z0-051-v9.02-033题,完整题库请点击这里联系老师咨询了解

33. You want to create an ORD_DETAIL table to store details for an order placed having the following

business requirement:

1) The order ID will be unique and cannot have null values.(唯一+非空约束=主键约束)

2) The order date cannot have null values and the default should be the current date. (order date非空default sysdate)

3) The order amount should not be less than 50.(不少于50,即大于等于50)

4) The order status will have values either shipped or not shipped.(order status IN ('Shipped', 'Not Shipped') )

5) The order payment mode should be cheque, credit card, or cash on delivery (COD).( order payment mode ('Cheque', 'Credit Card', 'Cash On Delivery'))

Which is the valid DDL statement for creating the ORD_DETAIL table?

A. CREATE TABLE ord_details

(ord_id NUMBER(2) CONSTRAINT ord_id_nn NOT NULL, 此处没有唯一约束

ord_date DATE DEFAULT SYSDATE NOT NULL,

ord_amount NUMBER(5, 2) CONSTRAINT ord_amount_min

CHECK (ord_amount > 50), 此处应该大于等于50

ord_status VARCHAR2(15) CONSTRAINT ord_status_chk

CHECK (ord_status IN ('Shipped', 'Not Shipped')),

ord_pay_mode VARCHAR2(15) CONSTRAINT ord_pay_chk

CHECK (ord_pay_mode IN ('Cheque', 'Credit Card',

'Cash On Delivery')));

B. CREATE TABLE ord_details

(ord_id NUMBER(2) CONSTRAINT ord_id_uk UNIQUE NOT NULL,

ord_date DATE DEFAULT SYSDATE NOT NULL,

ord_amount NUMBER(5, 2) CONSTRAINT ord_amount_min

CHECK (ord_amount > 50), 此处应该大于等于50

ord_status VARCHAR2(15) CONSTRAINT ord_status_chk

CHECK (ord_status IN ('Shipped', 'Not Shipped')),

ord_pay_mode VARCHAR2(15) CONSTRAINT ord_pay_chk

CHECK (ord_pay_mode IN ('Cheque', 'Credit Card',

'Cash On Delivery')));

C. CREATE TABLE ord_details

(ord_id NUMBER(2) CONSTRAINT ord_id_pk PRIMARY KEY,

ord_date DATE DEFAULT SYSDATE NOT NULL,

ord_amount NUMBER(5, 2) CONSTRAINT ord_amount_min

CHECK (ord_amount >= 50),

ord_status VARCHAR2(15) CONSTRAINT ord_status_chk

CHECK (ord_status IN ('Shipped', 'Not Shipped')),

ord_pay_mode VARCHAR2(15) CONSTRAINT ord_pay_chk

CHECK (ord_pay_mode IN ('Cheque', 'Credit Card',

'Cash On Delivery')));

D. CREATE TABLE ord_details

(ord_id NUMBER(2), 此处没有唯一非空约束

ord_date DATE NOT NULL DEFAULT SYSDATE, 此处报语法错误

ord_amount NUMBER(5, 2) CONSTRAINT ord_amount_min

CHECK (ord_amount >= 50),

ord_status VARCHAR2(15) CONSTRAINT ord_status_chk

CHECK (ord_status IN ('Shipped', 'Not Shipped')),

ord_pay_mode VARCHAR2(15) CONSTRAINT ord_pay_chk

CHECK (ord_pay_mode IN ('Cheque', 'Credit Card',

'Cash On Delivery')));

Answer: C

D答案应该先default sysdate,后not null。

sys@TEST0910> create table t7(ord_date date not null default sysdate);

create table t7(ord_date date not null default sysdate)

*

ERROR at line 1:

ORA-00907: missing right parenthesis

sys@TEST0910> create table t7(ord_date date default sysdate not null);

Table created.

CUUG 优技培训

中国Oracle培训领航专家

CUUG -CHINA UNIX USER GROUP,是国际UNIX组织UNIFORUM的中国代表,是国内悠久的专业UNIX培训机构,被誉为中国UNIX 的摇篮。

金牌讲师

行业资深实战专家 让学习就像在就业
展开

实操环境

让每一个DBA课程学员有真正的实操练习

让每一个DBA课程学员有真正的实操练习

让每一个DBA课程学员有真正的实操练习

让每一个DBA课程学员有真正的实操练习

院校合作

学校新闻

行业新闻

在线预约 抢先报名 获取课程排期

请输入您的手机号

申请试听
版权所有:北京神脑资讯科技有限公司
地址:北京市海淀区紫竹花园4号楼D座703
全国免费咨询电话:400-0909-964
电话:010-59426307 ,邮政编码:100089
E-mail:cuug_bj@cuug.com
拨打电话
在线咨询
首页