0% found this document useful (0 votes)
37 views24 pages

IT 240 Cardinality L#4

The document discusses cardinality in database design, focusing on maximum and minimum relationships between entities. It explains how to determine cardinality through examples and ER diagrams, detailing mandatory and optional relationships. Additionally, it includes a case study about a video game database to illustrate these concepts.

Uploaded by

deadku14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views24 pages

IT 240 Cardinality L#4

The document discusses cardinality in database design, focusing on maximum and minimum relationships between entities. It explains how to determine cardinality through examples and ER diagrams, detailing mandatory and optional relationships. Additionally, it includes a case study about a video game database to illustrate these concepts.

Uploaded by

deadku14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Cardinality

Ch3
• Link to examples used in this lecture
Database Design

1. Conceptual Model
2. Logical Model
3. Physical Model
Database Design
1. Conceptual Model
1. Entity
2. Attribute
3. Realationship
2. Logical Model
3. Physical Model
Determine cardinality: Maxima and Minima
• Cardinality: describing the number of things in a
relationship.
• Maximum cardinality
• Maximum number of instances one thing can be related to other
• one (Single relatioship)
Example: Each book has one primary author
• many (Multiple relatioship)
Example: A teacher can have many students

• Minimum cardinality
• Minimum number of instances one thing must be related to others
• Zero (Optional)
Example: A user may have zero car
Example: A Book might not belong to a library
• One (at least one, mandatory)
Example: A department must have at least one manager
Example: A doctor treats a patient
Cardinality- Maxima/ER
• Maximum of one

• On ERD shown as short bar across the relationship


Maximum of many

• Maximum of many

• On ERD shown as three short lines Maximum of one


Determine cardinality-
Maxima
Question: Draw the ERD for the relationship below:
• Each employee is assigned to a parking spot
• Each parking is assigned to one employee only
Determine cardinality- Maxima
Question: Draw the ERD for the relationship below:
• Each employee is assigned to a parking spot
• Each parking is assigned to one employee only

Each parking lot is Assigned to one Employee


IsAssigned
Employee ParkingSpot

Each Employee is Assigned to one parking spot

One to one relationship


Question: Draw the ERD for the
Determine relationship below:
• A product line contains many
cardinality- products
• A product belongs to only one
Maxima product line
Determine cardinality- Maxima
Question: Draw the ERD for the relationship below:
• A product line contains many products
• A product belongs to only one product line

Contains
Product ProductLine
Determine cardinality-
Maxima
Question: Draw the ERD for the relationship below:
• A Student register for many Courses
• A Course can have many Students
Determine cardinality- Maxima
Question: Draw the ERD for the relationship below:
• A Student registers for many Courses
• A Course can have many Students

Registers
Student Course
Determine cardinality: Maxima
Question: Describe the business rule from the following ERD?

ProductLine Product
Determine cardinality: Maxima
Question: Describe the business rule from the following ERD?

Answer:
Places • A Customer can place many orders
Customer Order
• An order is placed by only one customer
Determine cardinality:
Maxima
Question: Draw the ERD for the relationship below:
- A person can have only one passport.
- A passport belongs to only on person.
Determine cardinality:
Maxima
Question: Draw the ERD for the relationship below:
- Each student can join multiple clubs.
- Each club contains many students

- Each student can participate in multiple events.


- Each event can have many students.
Determine cardinality- Minima
• Minima of One
• A related entity is required(mandatory) when the minimum
is one.
• at least one instance of the related entity must be associated with an instance of the
primary entity.

• Minima of zero
• A related entity is optional when the minimum is zero
• an instance of one entity can exist without being associated with any instance
of the related entity.
Determine cardinality- Minima
• Minima of One
• On ER diagram is shown as short bar across the relationship bar
Minima of one
• Minima of zero
• Shown as circle

Minima of zero
Maxima and Minima on The ER
• Mandatory One:
• Max One, Min One
• Optional One:
• Max One, Min Zero
• Mandatory Many:
• Max Many, Min One
• Optional Many:
• Max Many, Min Zero
Determine cardinality- Maxima and Minima
Question: Draw the ERD for the relationship below:
• Each presenter must be assigned one presentation slot
• Each presentation slot must belong to only one presenter

Assigned
Presenter PresentationSlot
Determine cardinality- Maxima and Minima
Question: Draw the ERD for the relationship below:
• Each Employee can be assigned one parking spot
• Parking spot can belong to one employee and can be unassigned

Assigned
Employee ParkingSpot
Determine cardinality- Maxima and Minima
Question: Draw the ERD for the relationship below:
• Each Patient have at least one medical record
• Each medical record must belong to only one patient

Patient MedicalRecord
Belongs
Determine cardinality- Maxima and Minima
Question: Draw the ERD for the relationship below:
• A Player can earn multiple Achievements in a game.
• An Achievement must be earned by at least one Player
Determine cardinality- Maxima and Minima
Question: Draw the ERD for the relationship below:
• A Player can earn multiple Achievements in a game.
• An Achievement must be earned by at least one Player

Earns
Player Achievement
Case Study
• Imagine you’re building a video game database. In this game, players
can progress through multiple levels.
• A Player can play multiple Levels in the game, but must start at level
1 and can advance through all levels.
• A Level can have many Players who have reached that level, but a
Level doesn’t exist unless at least one Player has completed it.

You might also like