Only Click My Ads Brother, Help this Site Alive

Saturday, July 16, 2016

SOLOSOLOKU: Section 14 Quiz

Section 14 Quiz
(Answer all questions in this section)

1. A composite primary key may only be defined at the table level. True or False?

True (*)
False

2. Which statement about a non-mandatory foreign key constraint is true?

A foreign key value cannot be null.
A foreign key value must match an existing value in the parent table.
A foreign key value must either be null or match an existing value in the parent table. (*)
A foreign key value must be unique.

3. The table that contains the Primary Key in a Foreign Key Constraint is known as:

Mother and Father Table
Detail Table
Parent Table (*)
Child Table

4. Evaluate this CREATE TABLE statement:
CREATE TABLE part(
part_id NUMBER,
part_name VARCHAR2(25),
manufacturer_id NUMBER(9),
retail_price NUMBER(7,2) NOT NULL,
CONSTRAINT part_id_pk PRIMARY KEY(part_id),
CONSTRAINT cost_nn NOT NULL(cost),
CONSTRAINT FOREIGN KEY (manufacturer_id) REFERENCES manufacturer(id));
Which line will cause an error?

5
6
7 (*)
8

5. You need to create a composite primary key constraint on the EMPLOYEES table. Which
statement is true?  

The PRIMARY KEY constraint must be defined at the table level. (*)
A PRIMARY KEY constraint must be defined for each column in the composite primary key.
The PRIMARY KEY constraint must be defined at the table level and for each column in the composite primary key.
The PRIMARY KEY constraint must be defined for the first column of the composite primary key.

Section 14 Quiz
(Answer all questions in this section)

6. You can drop a column in a table with a simple ALTER TABLE DROP COLUMN statement, even if the column is referenced in a constraint. True or False?  

True
False (*)

7. You need to add a NOT NULL constraint to the EMAIL column in the EMPLOYEES table. Which clause should you use?  

CHANGE
DISABLE
ADD
MODIFY (*)

8. You need to add a PRIMARY KEY constraint on the EMP_ID column of the EMPLOYEES table. Which ALTER TABLE statement should you use?  

ALTER TABLE employees
ADD CONSTRAINT PRIMARY KEY (emp_id);

ALTER TABLE employees
MODIFY emp_id PRIMARY KEY;

ALTER TABLE employees
MODIFY CONSTRAINT PRIMARY KEY (emp_id);

ALTER TABLE employees
ADD CONSTRAINT emp_emp_id_pk PRIMARY KEY(emp_id); (*)

Incorrect Incorrect. Refer to Section 14 Lesson 3.

9. Which statement should you use to add a FOREIGN KEY constraint to the DEPARTMENT_ID column in the EMPLOYEES table to refer to the DEPARTMENT_ID column in the DEPARTMENTS table?  

ALTER TABLE employees
ADD CONSTRAINT dept_id_fk FOREIGN KEY (department_id) REFERENCES departments(department_id);(*)

ALTER TABLE employees
ADD FOREIGN KEY CONSTRAINT dept_id_fk ON (department_id) REFERENCES departments(department_id);

ALTER TABLE employees
MODIFY COLUMN dept_id_fk FOREIGN KEY (department_id) REFERENCES departments(department_id);

ALTER TABLE employees
ADD FOREIGN KEY departments(department_id) REFERENCES (department_id);

Incorrect Incorrect. Refer to Section 14 Lesson 3.

10. What mechamisn does Oracle use in the background to enforce uniqueness in Primary and Unique key constraints?

Unique indexes are created in the background by Oracle when Primary and Unique constraints are created or enabled (*)
Nothing extra is created when Primary Keys and Unique Keys are created
Internal Pointers
Ordered Lists

Section 14 Quiz
(Answer all questions in this section)

11. You need to ensure that the LAST_NAME column does not contain null values. Which type of constraint should you define on the LAST_NAME column?  

CHECK
PRIMARY KEY
UNIQUE
NOT NULL (*)

12. Which constraint can only be created at the column level?  

FOREIGN KEY
UNIQUE
NOT NULL (*)
CHECK

13. You need to ensure that each value in the SEAT_ID column is unique or null. Which constraint should you define on the SEAT_ID column?  

PRIMARY KEY
CHECK
UNIQUE (*)
NOT NULL

14. Evaluate this CREATE TABLE statement:
CREATE TABLE customers
    (customer_id NUMBER,
     customer_name VARCHAR2(25),
     address VARCHAR2(25),
     city VARCHAR2(25),
     region VARCHAR2(25),
     postal_code VARCHAR2(11),
     CONSTRAINT customer_id_un UNIQUE(customer_id),
     CONSTRAINT customer_name_nn NOT NULL(customer_name));

Why does this statement fail when executed?

The CREATE TABLE statement does NOT define a PRIMARY KEY.
The NUMBER data types require precision values.
NOT NULL constraints CANNOT be defined at the table level. (*)
UNIQUE constraints must be defined at the column level.

Incorrect Incorrect. Refer to Section 14 Lesson 1.

15. A table can have more than one UNIQUE key constraint. True or False?

True (*)
False

No comments:

Post a Comment