Presentation is loading. Please wait.

Presentation is loading. Please wait.

Relationships—Topics

Similar presentations


Presentation on theme: "Relationships—Topics"— Presentation transcript:

1 Relationships—Topics
Relationship Cardinality & Notation Policy and Cardinality

2 Identify “Information Elements” Identify Entities
Database Design Steps Identify “Information Elements” Identify Entities Identify Primary Keys Identify Relationships Fix Relationship Problems Identify Non-Key Attributes Fix Attribute Problems Address Performance Issues Build Application Objects (stored procedures, views) Design Reports List is not strictly sequential Some steps performed recursively Some steps require returning to previous steps

3 Cardinality Understanding “Cardinality” is one of the most fundamentally important concepts in DB design Cardinality indicates how many occurrences of an entity must or may be allowed in the relationship with any one occurrence in the other entity Cardinality goes in each direction One student may/must take ? Classes One class must/may be taken by ? Students

4 Relationship Cardinality (cont.)
The measure of cardinality has two components at each end of the relationship: A maximum (usually either 1 or an unconstrained number greater than one, referred to as “many”) A minimum (usually either 0 or 1 but other values are possible, though rare) Relationship is mandatory if at least one matching record is required (minimum is 1) Relationship is optional if a matching record is not required (minimum is 0)

5 Cardinality Notation Entity Entity Entity Entity Mandatory One
One professor must have exactly one phone number Mandatory Many A customer must have at least one purchase to be a customer but may have many Optional One One professor may have as few as zero reserved parking spaces but may have only one at most Optional Many One student may take as few as zero classes but may take more than one class Entity Entity Entity

6 Cardinality Notation (cont.)
Interpret these cardinalities

7 Cardinality Notation (cont.)
Relationship cardinality is governed by the number of related occurrences you could have If a student could have two majors then relationship is ‘Many’ on the Major side May a car or house have more than one owner? May an Employee be assigned to more than one job title at a time? Will you record a Supplier if you do not currently carry any of their products? Will you enter an Employee without assigning them to a position?

8 Cardinality Notation (cont.)
Two Common Beginner Problems Historical Data: Moment of Creation Test:

9 Cardinality Notation (cont.)
Commonly used verbal shorthand ignores the minimum component of a relationship 1:M (one-to-many) 1:1 (one-to-one) M:M (or M:N) (many-to-many)

10 Cardinality Notation (cont.)
The graphical layout of a relationship is purely arbitrary

11 Organization Policy and Cardinality
Business policies (or regulations) may affect cardinality

12 Exercise Refer back to your entity diagram you created in Module 1 (Exercise #3) Identify the cardinalities at both ends of each relationship in the exercise Minimum cardinality Maximum cardinality


Download ppt "Relationships—Topics"

Similar presentations


Ads by Google