Multiple choice technology databases

Examine the SQL statement 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 columns would an index be automatically created when you execute the above SQL statement?

  1. SER_NO

  2. ORDER_ID

  3. STATUS

  4. PROD_ID

  5. ORD_TOTAL

  6. composite index on ORDER_ID and ORDER_DATE

Reveal answer Fill a bubble to check yourself
A,F Correct answer
Explanation

Unique constraints (SER_NO UNIQUE) and primary keys (PRIMARY KEY) automatically prompt the database to create unique indexes to enforce uniqueness.

AI explanation

To determine which columns would have an index automatically created when executing the given SQL statement, we need to consider the following:

  1. The "UNIQUE" constraint on the "SER_NO" column would automatically create an index for that column (Option A).

  2. The "PRIMARY KEY" constraint on the combination of "ORDER_ID" and "ORDER_DATE" columns would automatically create a composite index on those columns (Option F).

Therefore, the correct answer is options A and F.