Senin, 04 Desember 2017

Database programming section 14

1. A table must have at least one not null constraint and one unique constraint. True or False?
False (*)

2. 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?
ALTER TABLE part
MODIFY (cost CONSTRAINT part_cost_nn NOT NULL);
(*)

3. Which statement about constraints is true?
NOT NULL constraints can only be specified at the column level. (*)

4. Which of the following is not a valid Oracle constraint type?
EXTERNAL KEY (*)

5. A column defined as NOT NULL can have a DEFAULT value of NULL. True or False?
False (*)

6. Foreign Key Constraints are also known as:
Referential Integrity Constraints (*)

7. Which of the following pieces of code will successfully create a foreign key in the CDS table that references the SONGS table?
All of the above (*)

8. Which of the following best describes the function of a CHECK constraint?
A CHECK constraint defines restrictions on the values that can be entered in a column or combination of columns. (*)

9. The number of check constraints that can be defined on a column is:
There is no limit (*)

10. The table that contains the Primary Key in a Foreign Key Constraint is known as:
Parent Table (*)

11. All of a user's constraints can be viewed in the Oracle Data Dictionary view called:
USER_CONSTRAINTS (*)

12. Evaluate this statement
ALTER TABLE employees
ENABLE CONSTRAINT emp_id_pk;
For which task would you issue this statement?
To activate the previously disabled constraint on the EMPLOYEE_ID column while creating a PRIMARY KEY index (*)

13. You can view the columns used in a constraint defined for a specific table by looking at which data dictionary table?
USER_CONS_COLUMNS (*)

14. What is the syntax for removing a PRIMARY KEY constraint and all its dependent constraints?
ALTER TABLE table_name
DROP CONSTRAINT constraint_name CASCADE;
(*)

15. Examine the structures of the PRODUCTS and SUPPLIERS tables.
PRODUCTS:
PRODUCT_ID NUMBER NOT NULL, PRIMARY KEY
PRODUCT_NAME VARCHAR2 (25)
SUPPLIER_ID NUMBER FOREIGN KEY to SUPPLIER_ID of the SUPPLIER table
LIST_PRICE NUMBER (7,2)
COST NUMBER (7,2)
QTY_IN_STOCK NUMBER
QTY_ON_ORDER NUMBER
REORDER_LEVEL NUMBER
REORDER_QTY NUMBER
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)
Evaluate this statement:
ALTER TABLE suppliers
DISABLE CONSTRAINT supplier_id_pk CASCADE;
For which task would you issue this statement?
To disable any dependent integrity constraints on the SUPPLIER_ID column in the SUPPLIERS table (*)

Tidak ada komentar:

Posting Komentar