Examine the SQL statements that creates ORDERS table: CREATE TABLE orders (SER_NO NUMBER UNIQUE, ORDER_ID NUMBER, ORDER_DATE DATE NOT NULL, STATUS VARCHAR2(10) CHECK (status IN('CREDIT','CASH')), PROD_ID NUMBER REFERENCES PRODUCTS(PRODUCT_ID), ORD_TOTAL NUMBER, PRIMARY KEY (order_id,order_date)); For which column would an index be automatically created when you execute the above SQL statement?(Choose two)

  1. SER_NO

  2. ORDER_ID

  3. STATUS

  4. PROD_ID

  5. ORD_TOTAL

  6. Composite index on ORDER_ID and ORDER_DATE


Correct Option: A,F

AI Explanation

To determine which column(s) would have an index automatically created when executing the given SQL statement, let's analyze each column in the CREATE TABLE statement:

A. SER_NO - The column SER_NO has the UNIQUE constraint, which automatically creates an index on this column.

B. ORDER_ID - The column ORDER_ID is part of the PRIMARY KEY constraint, but it does not automatically create an index on this column.

C. STATUS - The column STATUS has a CHECK constraint but does not automatically create an index on this column.

D. PROD_ID - The column PROD_ID has a REFERENCES constraint, which does not automatically create an index on this column.

E. ORD_TOTAL - The column ORD_TOTAL does not have any constraints that would automatically create an index on this column.

F. Composite index on ORDER_ID and ORDER_DATE - The PRIMARY KEY constraint on (order_id, order_date) automatically creates a composite index on these columns.

Based on the analysis above, the columns that would have an index automatically created when executing the SQL statement are:

A. SER_NO F. Composite index on ORDER_ID and ORDER_DATE

Therefore, the correct answer is A and F.

Find more quizzes: