ER diagroms Composite Key representation in m;n relationship

48 Views Asked by At

Student:

student_id (Primary Key)
first_name
last_name
date_of_birth
contact_number
email_address

Course:

course_id (Primary Key)
course_name
course_code
department

Faculty:

faculty_id (Primary Key)
first_name
last_name
department
contact_number
email_address

Enrollment:

enrollment_id (Primary Key)
student_id (Foreign Key referencing Student)
course_id (Foreign Key referencing Course)
grade  

How can you represent these in a ERd Is it ok to represent erollment as a relationship as Student Enrols in courses?

Representing M:N relationships in ER

1

There are 1 best solutions below

0
Christophe On

In your model, Enrolment could be represented in an ERD either as:

  • An entity, since the enrollment_id primary key gives it an own identity. This entity would have two one-to many associations with Student and Course respectively; or as
  • An associative entity, since enrolment implements clearly a many to many association between Student and Course and it could not exist without any of the two. Associative entities should not have their own identity however. You could therefore remove enrolment_id and use a combined primary key made of student_id and course_id. You'd just have to underline both of them in the attributes (assuming Chen notation). If several enrolments are possible for the same student and course, you'd need a their component in the composite primary key (a simple sequential number, or a semester id).