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

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

时间:2017-05-04 13:30:14      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:customer   lin   语句   nts   选中   结构   select   als   win   

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……,哪一个表述是正确的?

 

技术分享

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 specifiedcolumns 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题

标签:customer   lin   语句   nts   选中   结构   select   als   win   

原文地址:http://www.cnblogs.com/brucemengbm/p/6806482.html

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