Top Banner
Modeling Relationships Data Modeling and Relational Database Design
25

Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Dec 25, 2015

Download

Documents

Allen Matthews
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Modeling RelationshipsData Modeling and Relational Database Design

Page 2: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Objectives

Analyze and model the relationships between entities

Draw an initial entity relationship diagram

Read the relationships on an ER diagram

Clearly define relationship names

Page 3: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Relationship Definitions

The way one entity relates to another

The business rules that link together business information needs

What one thing has to do with another

A named association between entities

Page 4: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Bi-directional Relationships

DMDD COURSE SMT COURSESMT COURSE

INSTRUCTOR COURSE

Page 5: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Diagramming Conventions

A line between two entities

Lower case relationship name

Optionality (Minimum cardinality)

Degree (Maximum cardinality)

Optional - may beMandatory - must be

One or more

One and only one

Page 6: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Diagramming Conventions

COPY TITLE

many(crow’s foot)

mandatory

optional

one

Page 7: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Relationship Syntax

Each

Subject entity

must beormay be

relationshipname

one or moreorone and only one

entity 1 entity 2

DegreeObject entityOptionality Name

Page 8: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Validation - in class practice

EMPLOYEE DEPARTMENTassigned to

Page 9: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Validation - in class solution

EMPLOYEE DEPARTMENTassigned to

Each EMPLOYEE must be assigned to one and only one DEPARTMENT

Page 10: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Validation - in class practice

EMPLOYEE DEPARTMENT

responsible for

Page 11: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Validation - in class solution

EMPLOYEE DEPARTMENT

Each DEPARTMENT may be responsible for one or more EMPLOYEES

responsible for

Page 12: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

EMPLOYEE DEPARTMENTassigned to

Each EMPLOYEE must be assigned to one and only one DEPARTMENT

EMPLOYEE DEPARTMENT

Each DEPARTMENT may be responsible for one or more EMPLOYEES

responsible for

Validation - in class solution

Page 13: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Validation - in class practice

taken by

enrolled inSTUDENT COURSE

Page 14: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Validation - in class solution

Each STUDENT may be enrolled in one or more COURSES

Each COURSE may be taken by one or more STUDENTS

taken by

enrolled inSTUDENT COURSE

Page 15: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Relationship Types

Many-to-One

One-to-One

Many-to-Many

Page 16: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Many-to-One Relationships

CUSTOMER SALES REPRESENTATIVE

assigned to

visited by

Page 17: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Many-to-Many Relationships

PATIENT HEALTH CARE WORKER

assigned to

attended by

Page 18: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

One-to-One Relationships

BICYCLE CYCLIST

the rider of

is ridden by

Represents a snapshot in time

Page 19: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Analyzing & Modeling Relationships

1 Determine the existence of a relationship

2 Name each direction of the relationship

3 Determine the degree of each direction of the relationship

4 Determine the optionality of each direction of the relationship

5 Read the relationship aloud to validate it

Page 20: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Determining a Relationship’s ExistenceExistenceName

OptionalityDegree

Validate

MEMBERSHIP COPY

COPY

RENTAL

RENTAL

MEMBERSHIP

RENTAL

MEMBERSHIP

COPY

Page 21: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Naming the RelationshipExistenceName

OptionalityDegree

Validate

COPY TITLEof

available as

Each title is available as a copy and each copy is of a title

Page 22: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Determining the Degree

Name

OptionalityDegree

Validate

Existence

COPY TITLE

one

many

Each title is available as a copy, there could be lots of copies but there is only ever one title on a copy

Page 23: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Determining the OptionalityExistenceName

OptionalityDegree

Validate

optional

mandatory

COPY TITLE

Every copy must have a title on it but we needinformation about titles even if there is no copy

Page 24: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Validating the Relationship

ExistenceName

OptionalityDegree

Validate

COPY TITLEof

available as

Each copy must be of one and only one title, and each title may be available as one or more copies

Page 25: Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.

Summary

Establish the existence of a relationship

Name the relationship

Determine its degree

Determine its optionality

Read the relationship to validate it