Which statement accomplishes this?

You need to create a table named ORDERS that contains four columns:
1. an ORDER_ID column of number data type
2. a CUSTOMER_ID column of number data type
3. an ORDER_STATUS column that contains a character data type
4. a DATE_ORDERED column to contain the date the order was placed
When a row is inserted into the table, if no value is provided for the status of the order, the value
PENDING should be used instead.
Which statement accomplishes this?

You need to create a table named ORDERS that contains four columns:
1. an ORDER_ID column of number data type
2. a CUSTOMER_ID column of number data type
3. an ORDER_STATUS column that contains a character data type
4. a DATE_ORDERED column to contain the date the order was placed
When a row is inserted into the table, if no value is provided for the status of the order, the value
PENDING should be used instead.
Which statement accomplishes this?

A.
CREATE TABLE orders (
order_id NUMBER(10),
customer_id NUMBER(8),
order_status VARCHAR2(10) DEFAULT ‘PENDING’,
date_ordered VARCHAR2 );

B.
CREATE TABLE orders (
order_id NUMBER(10),
customer_id NUMBER(8),
order_status VARCHAR2(10) DEFAULT ‘PENDING’,
date_ordered DATE );

C.
CREATE OR REPLACE TABLE orders (
order_id NUMBER(10),
customer_id NUMBER(8),
order_status VARCHAR2(10) DEFAULT ‘PENDING’,
date_ordered DATE );

D.
CREATE TABLE orders (
order_id NUMBER(10),
customer_id NUMBER(8),
order_status NUMBER(10) DEFAULT ‘PENDING’,
date_ordered DATE );

E.
CREATE OR REPLACE TABLE orders (
order_id NUMBER(10),
customer_id NUMBER(8),
order_status VARCHAR2(10) = ‘PENDING’,
date_ordered DATE );

F.
CREATE TABLE orders (
order_id NUMBER(10),
customer_id NUMBER(8),
order_status VARCHAR2(10) = ‘PENDING’,
date_ordered DATE );

Explanation:

Requirement that Order_Status should be a character data type
Not E: Order_status must be a character data type. There is also a syntax error.



Leave a Reply 2

Your email address will not be published. Required fields are marked *


kishan

kishan

The Answer is : B because whenver we are not providing the data into the status of order then the default contraint will fire and insert the record with PENDING.