Module 05a - Relationship and Cardinality Flashcards
Data Model vs DB Design
- A data model is a plan or blueprint for a database design
- Data model is more generalized and abstract than DB design
- It is easier to change a data model then it is to change a database design, so it is the place to work through conceptual DB problems.
Data Model = Conceptual design
Conceptual design = data model
Logical design
Physical design
ER Model
Is a set of concepts and graphical symbols that can be used to create conceptual schemas
ER Model versions
- Original ER model - Peter Chen (1976)
- Extended ER model
- Information Engineering (IE) - James Martin (1990) “crow foot notation”
- IDEF1X
- UML
Crow foot notation
Developed by James Martin (1990), also known as crow foot notation. It is easier to understand
Entity
Something that can be identified and the users want to track
Entity class
A collection of entities of a given type
Entity instace
The occurrence of a particular entity
Attributes
Attributes describe an entity’s characteristics. All entity instances of a given entity class have the same attributes, but vary in the values of those attributes.
Identifier
- Are attributes that name, or identify, entity instances.
- The identifier of and entity instance consists of one or more of the entity’s attributes.
- Composite identifiers are identifiers that consists of two or more attributes.
- Identifiers in data models become keys in database designs.
Relationships
Associate one entity with another
Relationships classes vs Relationships instances
- Relationship classes are associations among entity classes
- Relationships instances are associations among entity instances
Degree
Is the number of entity classes in the relationship.
- Two entities have a binary relationship of degree two
- Three entities have ternary relationship of degree three
Cardinality
Means “count”, and is expressed as a number.
Maximum cardinality
Is the maximum number of entity instances that can participate in a relationship.
Minimum cardinality
Is the minimum number of the entity instances that must participate in a relationship.
Types of Maximum cardinality
One-to-One [1:1]
One-to-Many [1:N]
Many-to-Many [N:M]
HAS-A Relationships
Each entity instance has a relationship with another entity instance.
An EMPLOYEE has one or more COMPUTERs.
A COMPUTER has one assigned EMPLOYEE.
HAS-A vs IS-A
Inheritance: IS-A
- Cat “is a” animal
Composition: HAS-A
- Cat “has a” tail
Minimum Cardinality values
Minimums are generally stated as either zero or one:
IF zero [0] THEN participation in the relationship by the entity is optional, and no entity instance must participate in the relationship.
IF one [1] THEN participation in the relationship by the entity is mandatory, and at least one entity instance must participate in the relationship.
Minimum Cardinality representation
Minimum cardinality of zero [0] indicating optional participation is indicated by placing an oval next to the optional entity.
Minimum cardinality of one [1] indicating mandatory (required) participation is indicated by placing a vertical hash mark next to the required entity.