Lab Examples: Primary Key Constraint
Lab Examples: Primary Key Constraint
Lab Examples: Primary Key Constraint
LAB EXAMPLES:
UNIQUE Constraint:
Check Constraint:
View Constraint:
SHANZAY TAHIR DB LAB 11 2019-BSE-072
LAB TASKS
1. Add a table level primary key constraint to the “Employee_Detail” table on the ID
column. The constraint should be named at creation. Name the constraint my_emp_id_pk.
3. Add a column DEPT_ID to the “Employee_Detail” table. Add a foreign key reference on
the “Employee_Detail” table that ensures that the employee is not assigned to a nonexistent
department. Name the constraint my_emp_dept_id_fk.
SHANZAY TAHIR DB LAB 11 2019-BSE-072
4. Conform that the constraints were added by querying the USER_CONSTRAINTS view.
Note the types and names of the constraints.
5. Display the object names and types from USER_OBJECTS data dictionary view for the
“Employee_Detail” and “Dept_Detail” tables. Notice that the new tables and a new
index were created.