Entity Relationship Diagrams. Database Development Process Business Information Requirements...

37
Entity Relationship Diagrams

Transcript of Entity Relationship Diagrams. Database Development Process Business Information Requirements...

Entity Relationship Diagrams

Database Development Process

Database Development Process

Business Information Requirements

Operational Database

Conceptual Data Modeling

Logical Database Design

Physical Database Build

Business view

Systems view

Terminology Terminology LOGICALCONCEPTUAL

DESIGN

ENTITY

RELATIONSHIP

ATTRIBUTE

TABLE

FOREIGN KEY

COLUMN

(Business view) (Systems view)

ANALYSIS

UNIQUE IDENTIFIER

PRIMARY KEY

UNIQUE KEY

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

CS 450 ERD Conventions

EMPLOYEE DEPARTMENTWorks ForM 1

empnum

entity relationship

attribute

Participation Requirements (optionality)

Cardinality (degree)

key

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

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

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

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)

Relationship Diagramming Conventions

Relationship Diagramming Conventions

COPY TITLE

many(crow’s foot)

mandatory

optional

one

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

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

EMPLOYEE DEPARTMENTassigned to

EMPLOYEE DEPARTMENTassigned to

Each EMPLOYEE must be assigned to one and only one DEPARTMENT

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

EMPLOYEE DEPARTMENT

responsible for

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

EMPLOYEE DEPARTMENT

Each DEPARTMENT may be responsible for one or more EMPLOYEES

responsible for

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

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

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

taken by

enrolled in

STUDENT COURSE

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?

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

Oracle’s Layout GuidelinesOracle’s Layout Guidelines

Dead Crows Fly East !

Child Entity

Parent Entity (1)

Parent Entity (2)

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

Finding AttributesFinding Attributes

Is this attribute really needed ?

Beware of obsolete requirements from previous systems

Beware of derived data

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

Meaningful ComponentsMeaningful Components

PERSON

name

PERSON

last namefirst name

ITEM

code

ITEM

typevendornum

Break down aggregate attributes

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

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

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

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

*

Attribute OptionalityAttribute Optionality

EMPLOYEE

badge num

first name

last name

title

***o weight

o

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%

Using a DomainUsing a Domain

AUDIO

MONSTESUR

Movie

Game

Audio

Sound

Mono

Stereo

Surround

Creating an Entity

For DB Planning

Adding Details

Domains

Creating Relationships

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.

Editing in the RON