Question ID 4818 | You want to create an ORD_DETAIL table to store details for an order placed having the following business requirement:
|
Option A | The order ID will be unique and cannot have null values
The order date cannot have null values and the default should be the current date
The order amount should not be less than 50
The order status will have values either shipped or not shipped
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? AREATE 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 ('Shopped','Not Shipped')
ord_pay_mode VARCHAR2(15) CONSTRAINT ord_pay_chk CHECK (ord_pay_mode IN ('Cheque','Credit Card',
'Cash On Delivery')));
|
Option B | B. 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 ('Shopped','Not Shipped')
ord_pay_mode VARCHAR2(15) CONSTRAINT ord_pay_chk CHECK (ord_pay_mode IN ('Cheque','Credit Card',
'Cash On Delivery')));
|
Option C | C. 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 ('Shopped','Not Shipped')
ord_pay_mode VARCHAR2(15) CONSTRAINT ord_pay_chk
CHECK (ord_pay_mode IN ('Cheque','Credit Card',
'Cash On Delivery')));
|
Option D | D. 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 ('Shopped','Not Shipped')
ord_pay_mode VARCHAR2(15) CONSTRAINT ord_pay_chk CHECK (ord_pay_mode IN ('Cheque','Credit Card',
'Cash On Delivery')));
|
Correct Answer | B |