QuestionQ284

VerifiedCreating and Managing Tables

Examine the SQL statement that creates the 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 will an index be automatically created when you execute the preceding SQL statement?

Choose two
Explanation

Oracle Database automatically creates an index to enforce enabled UNIQUE and PRIMARY KEY constraints. Therefore, it creates a unique index for SER_NO and a composite index for the primary-key columns ORDER_ID and ORDER_DATE. The CHECK, NOT NULL, and foreign-key constraints do not cause indexes to be created automatically.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!