What are mapping cardinalities and participation constraints in an ER diagram?
MediumConceptER Model
Answer
Mapping cardinality states how many entities on one side of a relationship can be associated with one entity on the other side. Participation states whether every entity must take part in the relationship.
- One-to-one (1:1): a person has at most one passport, and a passport belongs to one person.
- One-to-many (1:N): a department has many employees, but each employee works in one department.
- Many-to-many (M:N): a student takes many courses, and a course has many students.
- Total participation (double line): every entity must take part, such as every employee belonging to a department. Partial participation (single line): only some entities take part, such as the few employees who manage a department.
Example: Converting each case to tables:
- 1:N Department-Employee: put
dept_idas a foreign key inemployee. - M:N Student-Course: create a separate table
enrolment(roll, course_id)with the composite primary key(roll, course_id). - 1:1 Person-Passport: put
person_idinpassportas a foreign key with aUNIQUEconstraint.