number Unary Binary Ternary
Fig. 2-2: Relationship Degree Example One entity related to another of the same entity type Entities of two different types related to each other Entities of three different types related to each other Note the error here . . .
My In-Class Example Skywalker’s Dogwalkers : – Relationship degrees?
Relationship Cardinality Ratios Tells only the _________number of entities of each type involved in this relationship For binary relationships – One-to-One (or 1:1) » In each relationship instance , each entity will have exactly one related instance – One-to-Many (or 1:M) » In each relationship instance , one entity will have a maximum of one related instance but an entity on the other side can have many related instances – Many-to-Many (or M:N) » In each relationship instance , both entities can have many related entity instances maximum
Fig 2-12a: Unary Relationships
Fig. 2-12b: Binary Relationships
Fig. 2-12c: Ternary Relationship Note the lack of a “natural” unique identifier Note: a relationship can have attributes of its own Also note: there are only three (not four) entities shown in this ER diagram. (only 3 named rectangles)
My In-Class Example Skywalker’s Dogwalkers : – Cardinality ratios?
Relationship Cardinality Constraints Possible constraint values : 0, 1, M (many) Cardinality constraints: the number (value) of instances of one entity that could or must be associated with each instance of another entity in that relationship _________ cardinality constraint – If zero, then it’s called optional – If one or more, then it’s called mandatory _________cardinality constraint – The maximum number possible » Not : the maximum that currently exists in the stored data Minimum Maximum
Relationship Cardinality Constraints Shown on an ER Diagram
Fig. 2-17a: Cardinality Constraints with mandatory minimum cardinalities
Fig. 2-17b: Cardinality Constraints Two sets ( four total constraints ) of cardinality constraints are shown: (1, M) and (0, M) – so this is a _____ order or ______ relationship An employee can be assigned to a minimum of zero projects and a maximum of many projects A project can be assigned to a minimum of one employee and a maximum of many employees
Fig. 2-17c: Optional Cardinalities With: Unary degree, one-to-one relationship A person can be married to a minimum of zero persons and a maximum of one person
Entities can be related to one another in more than one way Fig 2-21a: Entities with Multiple Relationships (1) Parse this diagram.
My In-Class Example Skywalker’s Dogwalkers : – Any sets of entities with multiple relationships between them?
(min, max) Constraints Constraints that specify integer values for: – the minimum and maximum number of entity instances that could possibly participate in a relationship – once the database is in a “steady state” » That is, when the database is old enough to require purging of historical records that are no longer needed The (min, max) values more precisely identify the maximum number of participating entities than does the cardinality constraint of “ M ” – Integer equivalent of is “0” – Integer equivalent of is “1”
- Fall '17
- Xi Li
- Entity-relationship model, Skywalker