OCP题库:1Z0-051-001题
最新学讯:近期OCP认证正在报名中,因考试人员较多请尽快报名获取最近考试时间,报名费用请联系在线老师,甲骨文官方认证,报名从速!
我要咨询OCP题库:1Z0-051-001题:完整题库请点击这里联系老师咨询了解
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这三个外键约束是没有被传递的。