Skip to content

CS Professional · Artificial Intelligence, Data Analytics and Cyber Security - Laws and Practice · Database Management

A student and course database records that many students enrol in many courses, with each enrolment also storing the date of enrolment. How should the many-to-many relationship and the enrolment date be implemented in relational tables?

Create a separate Enrolment table holding the student key and course key as foreign keys, forming a composite primary key, with the enrolment date as its own attribute. Many-to-many relationships need a junction table, and relationship attributes belong in it.

  1. ACreate an Enrolment table with student and course keys as foreign keys and the date as its attributeCorrect
  2. BStore the enrolment date in the Student table and the course key in each student row
  3. CStore a list of course IDs in a single column of the Student table
  4. DAdd the student key to the Course table and keep the date there

Explanation

A many-to-many relationship requires a separate junction table whose key combines the two foreign keys. An attribute of the relationship, such as enrolment date, belongs in that table. Other options store repeating groups or attach the date to the wrong entity, breaking normalisation.

Did you get it right without looking?

One question tells you little. A timed set on Database Management shows your real accuracy, how long you take and where you lose marks.

More Database Management questions