SQL Extensions   «Prev  Next»

Oracle FOREIGN KEY, CHECK, and UNIQUE Constraints — Exercise

Match Constraint Components with Their Meanings

Objective: Distinguish Oracle datatypes, column clauses, inline constraints, and table-level constraints.

Exercise instructions

Match each numbered SQL fragment in the left column with the letter of its best description in the right column.

Enter one match per line in the response box, using the format 1-C, 2-A, and so forth. Use every letter once.

When all nine matches are complete, select Submit. The result page will preserve your response and display the answer key.

Exercise scoring

Each correct match is worth one point, for a total of nine points. Compare your submitted response with the answer key on the result page.

Numbered SQL fragments Lettered descriptions
  1. NUMBER(10,3)
  2. NOT NULL
  3. CHECK (JOB_TYPE IN ('W', 'B', 'X'))
  4. CONSTRAINT J_PK PRIMARY KEY (CUST_ID, SALES_ID)
  5. REFERENCES CUSTOMER_SALE (SALES_ID)
  6. DEFAULT 'MAIL'
  7. CONSTRAINT PROD_FK FOREIGN KEY (PROD_ID, SALES_ID)
    REFERENCES CUSTOMER_PRODUCT (PROD_ID, SALES_ID)
  8. CONSTRAINT GET_IT_UK UNIQUE (CUST_ID, PROD_ID)
  9. SSI_NUM VARCHAR2(10) UNIQUE
  1. Inline NOT NULL column constraint
  2. CHECK constraint restricting permitted values
  3. Numeric datatype with precision and scale
  4. Named composite PRIMARY KEY table constraint
  5. REFERENCES clause identifying a parent key
  6. Column default clause, which is not an integrity constraint
  7. Named composite FOREIGN KEY table constraint
  8. Named composite UNIQUE table constraint
  9. Inline UNIQUE constraint in a column definition

Enter all nine matches, one per line.