Section 14
Section 14
Section 14
1.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?
EMPLOYEE_ID NUMBER
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
DEPARTMENT_ID NUMBER
JOB_ID NUMBER
MANAGER_ID NUMBER
SALARY NUMBER(9,2)
HIRE_DATE DATE
The ALTER TABLE statement fails because the ADD CONSTRAINT clause contains a syntax error. (*)
3.A table can have more than one UNIQUE key constraint. True or False?
True (*)
4.You need to create a composite primary key constraint on the EMPLOYEES table. Which statement is true?
5.When creating the EMPLOYEES table, which clause could you use to ensure that salary values are 1000.00 or more?
SUPPLIERS:
SUPPLIER_ID NUMBER NOT NULL, PRIMARY KEY
SUPPLIER_NAME VARCHAR2 (25)
ADDRESS VARCHAR2 (30)
CITY VARCHAR2 (25)
REGION VARCHAR2 (10)
POSTAL_CODE VARCHAR2 (11)
To disable any dependent integrity constraints on the SUPPLIER_ID column in the SUPPLIERS table (*)
2. The PO_DETAILS table contains these columns:
PO_NUM NUMBER NOT NULL, Primary Key
PO_LINE_ID NUMBER NOT NULL, Primary Key
PRODUCT_ID NUMBER Foreign Key to PRODUCT_ID column of the PRODUCTS table
QUANTITY NUMBER
UNIT_PRICE NUMBER(5,2)
To disable the PRIMARY KEY and any FOREIGN KEY constraints that are dependent on the PO_NUM column (*)
Using the DELETE command on a row that contains a primary key with a dependent foreign key declared without either an ON DELETE
CASCADE or ON DELETE SET NULL. (*)
4. When dropping a constraint, which keyword(s) specifies that all the referential integrity constraints that refer to the primary and unique keys
defined on the dropped columns are dropped as well?
CASCADE (*)
5. All of a user's constraints can be viewed in the Oracle Data Dictionary view called:
USER_CONSTRAINTS (*)
Which CREATE TABLE statement should you use to create the DONATIONS table?
7. Which clause could you use to ensure that cost values are greater than 1.00?
8. What must exist on the Parent table before Oracle will allow you to create a FOREIGN KEY constraint from a Child table?
A PRIMARY or UNIQUE KEY constraint must exist on the Parent table. (*)
7 (*)
10. Which type of constraint by default requires that a column be both unique and not null?
CHECK (*)
14. 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?
15. A table must have at least one not null constraint and one unique constraint. True or False?
False (*)
1. When dropping a constraint, which keyword(s) specifies that all the referential integrity constraints that refer to the primary and unique keys
defined on the dropped columns are dropped as well?
CASCADE (*)
2. You need to remove the EMP_FK_DEPT constraint from the EMPLOYEE table in your schema. Which statement should you use?
3. What mechamisn does Oracle use in the background to enforce uniqueness in Primary and Unique key constraints?
Unique key indexes are created in the background by Oracle when Primary key and Unique key constraints are created or enabled (*)
4. You successfully create a table named SALARY in your company's database. Now, you want to establish a parent/child relationship between
the EMPLOYEES table and the SALARY table by adding a FOREIGN KEY constraint to the SALARY table that references its matching column in
the EMPLOYEES table. You have not added any data to the SALARY table. Which of the following statements should you issue?
5. What is the syntax for removing a PRIMARY KEY constraint and all its dependent constraints?
6. You need to add a NOT NULL constraint to the COST column in the PART table. Which statement should you use to complete this task?
7. 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?
UNIQUE (*)
The NOT NULL constraint must be defined at the column level. (*)
9. Which two statements about NOT NULL constraints are true? (Choose two)
The Oracle Server creates a name for an unnamed NOT NULL constraint. (*)
You CANNOT add a NOT NULL constraint to an existing column using the ALTER TABLE
ADD CONSTRAINT statement. (*)
10. What is the highest number of NOT NULL constraints you can have on a table?
You can have as many NOT NULL constraints as you have columns in your table. (*)
Line 5 (*)
Which CREATE TABLE statement should you use to create the DONATIONS table?
13. A Primary Key that is made up of more than one column is called a:
14. Which of the following FOREIGN KEY Constraint keywords identifies the table and column in the parent table?
REFERENCES (*)
15. What must exist on the Parent table before Oracle will allow you to create a FOREIGN KEY constraint from a Child table?
A PRIMARY or UNIQUE KEY constraint must exist on the Parent table. (*)
1. A composite primary key may only be defined at the table level. True or False?
True (*)
2. Which of the following FOREIGN KEY Constraint keywords identifies the table and column in the parent table?
REFERENCES (*)
3. You need to enforce a relationship between the LOC_ID column in the FACILITY table and the same column in the MANUFACTURER
table. Which type of constraint should you define on the LOC_ID column?
4. What must exist on the Parent table before Oracle will allow you to create a FOREIGN KEY constraint from a Child table?
A PRIMARY or UNIQUE KEY constraint must exist on the Parent table. (*)
6. 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?
UNIQUE (*)
NOT NULL constraints can only be specified at the column level. (*)
9. If the employees table has a UNIQUE constraint on the DEPARTMENT_ID column, we can only have one employee per department. True or
False?
True (*)
10. You need to ensure that the LAST_NAME column only contains certain character values. No numbers or special characters are allowed.
Which type of constraint should you define on the LAST_NAME column?
CHECK (*)
11. You need to add a NOT NULL constraint to the EMAIL column in the EMPLOYEES table. Which clause should you use?
MODIFY (*)
12. You need to remove the EMP_FK_DEPT constraint from the EMPLOYEE table in your schema. Which statement should you use?
13. You want to disable the FOREIGN KEY constraint that is defined in the EMPLOYEES table on the DEPARTMENT_ID column. The
constraint is referenced by the name FK_DEPT_ID_01. Which statement should you issue?
14. All of a user's constraints can be viewed in the Oracle Data Dictionary view called:
USER_CONSTRAINTS (*)
15. You need to add a PRIMARY KEY constraint on the EMP_ID column of the EMPLOYEES table. Which ALTER TABLE statement should
you use?
Which CREATE TABLE statement should you use to create the DONATIONS table?
3. To automatically delete rows in a child table when a parent record is deleted use:
4. The employees table contains a foreign key column department_id that references the id column in the departments table. Which of the
following constraint modifiers will NOT allow the deletion of id values in the department table?
The statement will NOT execute because it contains a syntax error. (*)
7. You successfully create a table named SALARY in your company's database. Now, you want to establish a parent/child relationship between
the EMPLOYEES table and the SALARY table by adding a FOREIGN KEY constraint to the SALARY table that references its matching column in
the EMPLOYEES table. You have not added any data to the SALARY table. Which of the following statements should you issue?
8. What is the syntax for removing a PRIMARY KEY constraint and all its dependent constraints?
ALTER TABLE table_name
DROP CONSTRAINT constraint_name CASCADE;
(*)
You need to disable the FOREIGN KEY constraint. Which statement should you use?
Add a FOREIGN KEY constraint to the EMPLOYEES table indicating that a manager must already be an employee. (*)
11. You need to ensure that the LAST_NAME column only contains certain character values. No numbers or special characters are allowed.
Which type of constraint should you define on the LAST_NAME column?
CHECK (*)
15. What is the highest number of NOT NULL constraints you can have on a table?
You can have as many NOT NULL constraints as you have columns in your table. (*)
1. A unique key constraint can only be defined on a not null column. True or False?
False (*)
2. What is the highest number of NOT NULL constraints you can have on a table?
You can have as many NOT NULL constraints as you have columns in your table. (*)
3. A table can only have one unique key constraint defined. True or False?
False (*)
4. Primary Key, Foreign Key, Unique Key, and Check Constraints can be added at which two levels? (Choose two)
Column (*)
Table (*)
5. You need to ensure that the LAST_NAME column only contains certain character values. No numbers or special characters are allowed.
Which type of constraint should you define on the LAST_NAME column?
CHECK (*)
6. You need to remove the EMP_FK_DEPT constraint from the EMPLOYEE table in your schema. Which statement should you use?
8. What is the syntax for removing a PRIMARY KEY constraint and all its dependent constraints?
SUPPLIERS:
SUPPLIER_ID NUMBER NOT NULL, PRIMARY KEY
SUPPLIER_NAME VARCHAR2 (25)
ADDRESS VARCHAR2 (30)
CITY VARCHAR2 (25)
REGION VARCHAR2 (10)
POSTAL_CODE VARCHAR2 (11)
To disable any dependent integrity constraints on the SUPPLIER_ID column in the SUPPLIERS table (*)
11. Which clause could you use to ensure that cost values are greater than 1.00?
Line 5 (*)
13. A composite primary key may only be defined at the table level. True or False?
True (*)
7 (*)
15. What must exist on the Parent table before Oracle will allow you to create a FOREIGN KEY constraint from a Child table?
A PRIMARY or UNIQUE KEY constraint must exist on the Parent table. (*)
1. You need to enforce a relationship between the LOC_ID column in the FACILITY table and the same column in the MANUFACTURER
table. Which type of constraint should you define on the LOC_ID column?
A CHECK constraint defines restrictions on the values that can be entered in a column or combination of columns. (*)
4. A composite primary key may only be defined at the table level. True or False?
True (*)
7 (*)
You need to disable the FOREIGN KEY constraint. Which statement should you use?
8. You need to remove the EMP_FK_DEPT constraint from the EMPLOYEE table in your schema. Which statement should you use?
To activate the previously disabled constraint on the EMPLOYEE_ID column while creating a PRIMARY KEY index (*)
Add a FOREIGN KEY constraint to the EMPLOYEES table indicating that a manager must already be an employee. (*)
11. A column defined as NOT NULL can have a DEFAULT value of NULL. True or False?
False (*)
12. 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?
14. 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?
UNIQUE (*)
NOT NULL constraints can only be specified at the column level. (*)