The enrolments table records which student enrolled in which course. It has no constraints yet. A student enrols in a course once.
- Is
student_idalone a superkey ofenrolments? Answer yes or no. - Make the pair
student_id,course_idthe primary key ofenrolments. The database refuses it. Which student does the DETAIL line name? - The second enrolment of that pair is a mistake: keep the row with the earlier date and remove the other one. Then add the primary key.
- Add a constraint named
enrolled_from_2020that refuses anenrolled_ondate before 2020-01-01.