Top Banner
Entity Relationship Diagrams
37

Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Dec 26, 2015

Download

Documents

Cameron Horton
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: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Entity Relationship Diagrams

Page 2: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Database Development Process

Database Development Process

Business Information Requirements

Operational Database

Conceptual Data Modeling

Logical Database Design

Physical Database Build

Business view

Systems view

Page 3: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Terminology Terminology LOGICALCONCEPTUAL

DESIGN

ENTITY

RELATIONSHIP

ATTRIBUTE

TABLE

FOREIGN KEY

COLUMN

(Business view) (Systems view)

ANALYSIS

UNIQUE IDENTIFIER

PRIMARY KEY

UNIQUE KEY

Page 4: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Information ModelsInformation Models

• Organize thought processes• Accurately model business data• Communicate with stakeholders• Analyze the scope• Provide sound basis for system

design

• Organize thought processes• Accurately model business data• Communicate with stakeholders• Analyze the scope• Provide sound basis for system

design

Page 5: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

CS 450 ERD Conventions

EMPLOYEE DEPARTMENTWorks ForM 1

empnum

entity relationship

attribute

Participation Requirements (optionality)

Cardinality (degree)

key

Page 6: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

heldby

the holderof

part of

composedof

RecursiveRelationship

Main Elements of an Oracle ERD

Main Elements of an Oracle ERD

Exclusive Arc

MEMBERSHIP

CUSTOMER# * customer number * first name * last name o other initials

COMPANY

SUPPLIER

OTHERCOMPANY

heldby

the holderof

UniqueIdentifier

Attributes

Relationship

Entity

Super-type

Sub-type

Page 7: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Hardware and Software IndependenceHardware and Software Independence

Agreement Term

Product

Agreement

Code Date Customer Code Description

Agreement Quantity ProductNumber

HIERARCHICAL DATABASE

NETWORK DATABASE

RELATIONAL DATABASE

Agreement Product x

Product yItem 1

Item 2

ENTITY RELATIONSHIP MODEL

Agreement

Item 1

Product X

Item 2

Product X

Page 8: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Relationship DefinitionsRelationship 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

• 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 9: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Relationship Diagramming Conventions

Relationship Diagramming Conventions

• A line between two entities• Lower case relationship name• Optionality (Minimum cardinality)

• A line between two entities• Lower case relationship name• Optionality (Minimum cardinality)

Optional - may be

Mandatory - must be

One or more

One and only one

• Degree (Maximum cardinality)

• Degree (Maximum cardinality)

Page 10: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Relationship Diagramming Conventions

Relationship Diagramming Conventions

COPY TITLE

many(crow’s foot)

mandatory

optional

one

Page 11: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Relationship SyntaxRelationship Syntax

Each

Subject entity

must beormay be

relationshipname

one or moreorone and only one

entity 1 entity 2

Degree

Object entityOptionality

Name

Entity 1 Entity 2

Page 12: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

How do you read this?How do you read this?

EMPLOYEE DEPARTMENTassigned to

Page 13: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

EMPLOYEE DEPARTMENTassigned to

Each EMPLOYEE must be assigned to one and only one DEPARTMENT

How do you read this?How do you read this?

Page 14: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

EMPLOYEE DEPARTMENT

responsible for

How do you read this?How do you read this?

Page 15: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

EMPLOYEE DEPARTMENT

Each DEPARTMENT may be responsible for one or more EMPLOYEES

responsible for

How do you read this?How do you read this?

Page 16: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

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

Full Reading of RelationshipFull Reading of Relationship

Page 17: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

How do you read this?How do you read this?

taken by

enrolled in

STUDENT COURSE

Page 18: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Each STUDENT may be enrolled in one or more COURSES

Each COURSE may be taken by one or more STUDENTS

taken by

enrolled in

STUDENT COURSE

How do you read this?How do you read this?

Page 19: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Analyzing and Modeling Relationships

Analyzing and Modeling Relationships

1 Determine the existence of a relationship2 Name each direction of the relationship3 Determine the degree of each direction of

the relationship4 Determine the optionality of each direction

of the relationship5 Read the relationship aloud to validate it

1 Determine the existence of a relationship2 Name each direction of the relationship3 Determine the degree of each direction of

the relationship4 Determine the optionality of each direction

of the relationship5 Read the relationship aloud to validate it

Page 20: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Oracle’s Layout GuidelinesOracle’s Layout Guidelines

Dead Crows Fly East !

Child Entity

Parent Entity (1)

Parent Entity (2)

Page 21: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

AttributesAttributesBadge Number - Identifies an employee

Name - Qualifies an employee

Payroll category (weekly or salaried) - Classifies an employee

Date of birth - Quantifies an employee

Employment status (active, leave, terminated) - Classifies of an employee

Page 22: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Finding AttributesFinding Attributes

Is this attribute really needed ?

Beware of obsolete requirements from previous systems

Beware of derived data

Page 23: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Attribute Diagramming Conventions

Attribute Diagramming Conventions

EMPLOYEE

badge numfirst namelast name

payroll num

date of birthemployment status

• Inside the entity's soft box

• Singular

• Lowercase

• Inside the entity's soft box

• Singular

• Lowercase

Page 24: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Meaningful ComponentsMeaningful Components

PERSON

name

PERSON

last namefirst name

ITEM

code

ITEM

typevendornum

Break down aggregate attributes

Page 25: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Verify for Single ValueVerify for Single ValueRENTAL

transaction date

total amount paid

item

Yes, more than one item may be rented at a time. An entity is missing.

Can an attribute have more than one value for one instance of the entity?

RENTAL

transaction date

total amount paid

RENTAL ITEM

item num

Page 26: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Attributes Which have Attributes

Attributes Which have Attributes

Does information need to be stored about any of the attributes?

Yes, review details. An entity is missing.

TITLE

product codetitledescriptionreview details

REVIEW

authorcommentdate recorded

product codetitledescriptionreview details

TITLE

Page 27: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Finding Common or Derived Data

Finding Common or Derived Data

• Count • Total• Maximum, Minimum, Average• Calculation

• Count • Total• Maximum, Minimum, Average• Calculation

Derived attributes are redundant and can lead to inconsistent values

12 08 30 22----72----

Page 28: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Attribute OptionalityAttribute Optionality

• A value must be stored for each entity instance• Tagged with

• A value must be stored for each entity instance• Tagged with

Mandatory Attributes

Optional Attributes

• A value may be stored for each entity instance

• Tagged with o

• A value may be stored for each entity instance

• Tagged with o

*

Page 29: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Attribute OptionalityAttribute Optionality

EMPLOYEE

badge num

first name

last name

title

***o weight

o

Page 30: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Attribute Details and Volumes

Attribute Details and Volumes

Attribute - * Engine Size

Format Type NumberMaximum length 4Average length 4Decimal place 1Unit of measure ccAllowable values 900,1000,1500,1800,2000

Volume Initial 100%

Page 31: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Using a DomainUsing a Domain

AUDIO

MONSTESUR

Movie

Game

Audio

Sound

Mono

Stereo

Surround

Page 32: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Creating an Entity

For DB Planning

Page 33: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Adding Details

Page 34: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Domains

Page 35: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Creating Relationships

Page 36: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Diagrammer Behavior

• Definition changes are stored in Definition changes are stored in Repository even if the diagram Repository even if the diagram is not saved.is not saved.

• Saving a diagram saves the Saving a diagram saves the layout.layout.

• Diagrams are not synchronized Diagrams are not synchronized automatically.automatically.

• Requerying is your Requerying is your responsibility.responsibility.

• Diagrams can be exported to, Diagrams can be exported to, for example, Word documents.for example, Word documents.

Page 37: Entity Relationship Diagrams. Database Development Process Business Information Requirements Operational Database Conceptual Data Modeling Logical Database.

Editing in the RON