zoukankan      html  css  js  c++  java
  • OCP-1Z0-051-题目解析-第33题

    33. You want to create an ORD_DETAIL table to store details for an order placed having the following business requirement: 
    1) The order ID will be unique and cannot have null values. 
    2) The order date cannot have null values and the default should be the current date. 
    3) The order amount should not be less than 50. 
    4) The order status will have values either shipped or not shipped. 
    5) The order payment mode should be cheque, credit card, or cash on delivery (COD). 
    Which is the valid DDL statement for creating the ORD_DETAIL table?

     
    1)order ID非空且唯一。

    →主键
    2)order date默认值是当前日期且非空。→Default sysdate Not NULL
    3)order amount 必须大于等于50。→check (order_mount >=50)
    4)order status 的值是shipped or not shipped。→ CHECK (ord_status IN ('Shipped', 'Not Shipped')
    5)order payment mode 的值是 cheque, credit card, or cash on delivery 。→CHECK (ord_pay_mode IN ('Cheque', 'Credit Card', 'Cash On Delivery')
    A.

    CREATE TABLE ord_details
      (
         ord_id       NUMBER(2) CONSTRAINT ord_id_nn NOT NULL,
         ord_date     DATE DEFAULT SYSDATE NOT NULL,
         ord_amount   NUMBER(5, 2) CONSTRAINT ord_amount_min CHECK (ord_amount > 50),
         ord_status   VARCHAR2(15) CONSTRAINT ord_status_chk CHECK (ord_status IN ('Shipped', 'Not Shipped')),
         ord_pay_mode VARCHAR2(15) CONSTRAINT ord_pay_chk CHECK (ord_pay_mode IN ('Cheque', 'Credit Card', 'Cash On Delivery'))
      );
    错误:ord_amount应该大于等于50.
    B.

    CREATE TABLE ord_details
      (
         ord_id       NUMBER(2) CONSTRAINT ord_id_uk UNIQUE NOT NULL,
         ord_date     DATE DEFAULT SYSDATE NOT NULL,
         ord_amount   NUMBER(5, 2) CONSTRAINT ord_amount_min CHECK (ord_amount > 50),
         ord_status   VARCHAR2(15) CONSTRAINT ord_status_chk CHECK (ord_status IN ('Shipped', 'Not Shipped')),
         ord_pay_mode VARCHAR2(15) CONSTRAINT ord_pay_chk CHECK (ord_pay_mode IN ('Cheque', 'Credit Card', 'Cash On Delivery'))
      );
    错误:ord_amount应该大于等于50.
    C.

    CREATE TABLE ord_details
      (
         ord_id       NUMBER(2) CONSTRAINT ord_id_pk PRIMARY KEY,
         ord_date     DATE DEFAULT SYSDATE NOT NULL,
         ord_amount   NUMBER(5, 2) CONSTRAINT ord_amount_min CHECK (ord_amount >= 50),
         ord_status   VARCHAR2(15) CONSTRAINT ord_status_chk CHECK (ord_status IN ('Shipped', 'Not Shipped')),
         ord_pay_mode VARCHAR2(15) CONSTRAINT ord_pay_chk CHECK (ord_pay_mode IN ('Cheque', 'Credit Card', 'Cash On Delivery'))
      );
    D.
    CREATE TABLE ord_details
      (
         ord_id       NUMBER(2),
         ord_date     DATE NOT NULL DEFAULT SYSDATE,
         ord_amount   NUMBER(5, 2) CONSTRAINT ord_amount_min CHECK (ord_amount >= 50),
         ord_status   VARCHAR2(15) CONSTRAINT ord_status_chk CHECK (ord_status IN ('Shipped', 'Not Shipped')),
         ord_pay_mode VARCHAR2(15) CONSTRAINT ord_pay_chk CHECK (ord_pay_mode IN ('Cheque', 'Credit Card', 'Cash On Delivery'))
      );
    错误, ord_id 是主键

    Answer: C 


  • 相关阅读:
    DL/T 467-2019 电站磨煤机及制粉系统性能试验
    fidlder-05(拦截并修改数据)
    fiddler-04(怎么对APP抓包)
    Redis5设计与源码分析读后感(二)简单动态字符串SDS
    Jedis连接搭建在阿里云服务器上的Redis,基于Linux(CentOS7)
    centos7下安装redis6.0版本+3种启动方式
    Linux下端口被占用的解决方法
    Linux卸载Nginx
    linux中普通用户修改密码出现(passwd:Authentication token manipulation error)
    linux重置密码提示与用户名相似该怎么解决?
  • 原文地址:https://www.cnblogs.com/blfshiye/p/5081451.html
Copyright © 2011-2022 走看看