Title: "[[Entity-Relationship-Model-Constraints]]"
status: DONE
tags:
- DataBase
- NOTE
- Lec2
Author:
- AllenYGY
created: 2023-11-03T00:59
updated: 2024-03-21T21:36
Entity-Relationship-Model-Constraints
“how many entities can be associated with one entity at most (or at least)?”
Can one student have multiple majors?
Can one program have multiple students?
Does every student have a major?
Is every program the major for some students?
To express the answers, ER diagrams have constraints on relationship sets.
Two types of constraints
“Cardinality” is a term from set theory. It is the number of items in a set.
To express the cardinality constraints.
ER diagrams use an arrow
For the many side, the links simply have no arrow (
Many student can only have one program
Here are some conditions for the example:
A one-to-many relationship is the reverse of many-to-one.
One entity from one entity set is associated with at most one entity from the other entity set and vice versa.
One entity from one entity set can be associated with multiple entities from the other entity set and vice versa.
we usually avoid using constraints on ternary relationship sets.
If expressing constraints is important, ternary relationship sets can always be converted into several binary ones.
Non-binary relationships with constrains is complex.