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


    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能够发现仅仅有非空约束传递到了新表)

     

  • 相关阅读:
    python基础-------模块与包(一)
    python基础-------函数(三)
    python基础-------函数(二)
    python基础-------函数(一)
    python基础(三)----字符编码以及文件处理
    python基础(二)-------数据类型
    python基础(一)------Python基础语法与介绍
    linux进程、软件包的安装和删除,及安装python3.6(源代码方式)
    Linux磁盘分区、打包压缩、软硬链接练习
    linux关于目录或文件权限的练习
  • 原文地址:https://www.cnblogs.com/brucemengbm/p/6806482.html
Copyright © 2020-2023  润新知