码迷,mamicode.com
首页 > 其他好文 > 详细

OCP-1Z0-051-题目解析-第1题

时间:2014-06-26 20:12:39      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   color   com   

1. View the Exhibit and examine the structure of the SALES, CUSTOMERS, PRODUCTS, and TIMES tables.

The PROD_ID column is the foreign key in the SALES table, which references the PRODUCTS table.

Similarly, the CUST_ID and TIME_ID columns are also foreign keys in the SALES table referencing the CUSTOMERS and TIMES tables,

respectively.

Evaluate the following CREATE TABLE command:

CREATE TABLE new_sales(prod_id, cust_id, order_date DEFAULT SYSDATE)

AS

SELECT prod_id, cust_id, time_id

FROM sales;

Which statement is true regarding the above command? 

 

题目翻译:查看下图并检查销售、客户、产品、日期表的结构。PROD_ID是销售表参考产品表的外键,同样的,CUST_ID和TIME_ID也是销售表的外键,分别参照了客户表和日期表,评估下面创建表的语句,CREATE……,哪一个表述是正确的?

 

bubuko.com,布布扣

A. The NEW_SALES table would not get created because the DEFAULT value cannot be specified in the

column definition.

B. The NEW_SALES table would get created and all the NOT NULL constraints defined on the specified

columns would be passed to the new table. 

C. The NEW_SALES table would not get created because the column names in the CREATE TABLE

command and the SELECT clause do not match. 

D. The NEW_SALES table would get created and all the FOREIGN KEY constraints defined on the

specified columns would be passed to the new table.

 

Answer: B

 答案解析:

A:不能创建表,原因是不能在定义字段指定默认值 (错误,我们可以再创建表的同时,通过Default指定相关字段的默认值)
B: 可以创建表,NOT NULL约束也可以传递到新表中 (正确,可以通过desc NEW_SALES 查看新表的结构)
C: 不能创建表,因为创建表的字段名和被选中表的字段名不一样 (错误,只要是对应字段的数据类型一致就可以了,字段名可以不一样)
D:可以创建表,并且所有的外键约束也会传递到新表中 (错误,通过desc NEW_SALES可以发现只有非空约束传递到了新表)

 

 

OCP-1Z0-051-题目解析-第1题,布布扣,bubuko.com

OCP-1Z0-051-题目解析-第1题

标签:des   style   blog   http   color   com   

原文地址:http://www.cnblogs.com/wjx515/p/3808408.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!