OCP-1Z0-051-題目解析-第33題

來源:互聯網
上載者:User

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 


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.