CSE302 Lab-2 Answers
CSE302 Lab-2 Answers
Department Table
The table will be called department, with dept_name as the primary key, and the budget
attribute will have a check constraint to ensure it is positive.
2. Course Table
The table will be called course, with course_id as the primary key, dept_name as a foreign
key referencing the department table, and a check constraint on credits to ensure it is
greater than or equal to 1.
Primary Key (pk_department): Ensures dept_name uniquely identifies each row in the
department table.
Check Constraint (chk_budget_positive): Enforces that budget must be positive in the
department table.
Foreign Key (fk_course_dept): Links dept_name in the course table to dept_name in the
department table, with ON DELETE CASCADE to automatically delete courses if the
corresponding department is deleted.
Primary Key (pk_course): Ensures course_id uniquely identifies each row in the course
table.
Check Constraint (chk_credits_positive): Ensures credits must be at least 1 in the
course table.
2. Schema Modification
1. ALTER TABLE department ADD head_of_department VARCHAR(50);