Oracle OCP认证-Oracle OCM认证

您当前的位置:优技教育 > ocp考试 >

ocp题库解析:11g-1Z0-051-第1题

来源:优技教育

ocp题库解析:11g-1Z0-051-第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?

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答案:默认sysdate可以在列出被指定。

sh@TEST0924> CREATE TABLE new_sales(prod_id, cust_id, order_date DEFAULT SYSDATE) AS

2 SELECT prod_id, cust_id, time_id FROM sales;

Table created.

B答案:NULL约束会传递。由以下可以看出,not null是可以传递的。B正确

C答案:

由A中所见,此表是可以创建的,虽然字段名不一样,但数据库类型一样,就可以创建表。C错误。

D答案:

由B第二种方法看出,仅仅只是传递了not null约束,而SALES_PRODUCT_FK,SALES_CUSTOMER_FK,SALES_TIME_FK这三个外键约束是没有被传递的。

精华阅读