Sei sulla pagina 1di 37

Entity Relationship Diagrams

Database Development
Process
Business Information Requirements

Conceptual Data Business view


Modeling

Logical Systems view


Database Design

Physical
Database Build

Operational Database
Terminology
CONCEPTUAL LOGICAL
(Business view) (Systems view)

ANALYSIS DESIGN

ENTITY TABLE

RELATIONSHIP FOREIGN KEY

ATTRIBUTE COLUMN

UNIQUE PRIMARY KEY


IDENTIFIER UNIQUE KEY
Information Models
• Organize thought processes
• Accurately model business data
• Communicate with stakeholders
• Analyze the scope
• Provide sound basis for system design
CS 450 ERD Conventions
attribute Cardinality
(degree)
empnum
key
M 1
EMPLOYEE Works For DEPARTMENT

entity relationship
Participation Requirements
(optionality)
Main Elements of an Oracle ERD
Relationship
CUSTOMER Unique
held # * customer number Identifier
Entity MEMBERSHIP by * first name
* last name Attributes
the holder
o other initials
of

COMPANY
held Super-type
by SUPPLIER
Sub-type
the holder
of
OTHER
composed COMPANY
of

part of Recursive
Relationship
Exclusive Arc
Hardware and Software Independence
ENTITY RELATIONSHIP MODEL

Agreement Product
Term

NETWORK
HIERARCHICAL Agreement
DATABASE
DATABASE

Agreement Agreement Product x

Item Item 2 Product y


1 Item 1
Item 2
Product X Product X RELATIONAL
DATABASE

Code Date Customer Code Description

Agreement Number Quantity Product


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
Relationship Diagramming
Conventions
• A line between two entities
• Lower case relationship name
• Optionality (Minimum cardinality)
Mandatory - must be
Optional - may be

• Degree (Maximum cardinality)


One or more
One and only one
Relationship Diagramming
Conventions

COPY TITLE

many
(crow’s foot) optional
mandatory one
Relationship Syntax

must be relationshi one or more


Each Entity
entity 11 or p or Entity
entity 2
2
may be name one and only one

Subject Name Object


entity Optionality entity
Degree
How do you read this?

assigned to
EMPLOYEE DEPARTMENT
How do you read this?

assigned to
EMPLOYEE DEPARTMENT

Each EMPLOYEE must be assigned to one and only one DEPARTMENT


How do you read this?

EMPLOYEE DEPARTMENT
responsible for
How do you read this?

EMPLOYEE DEPARTMENT
responsible for

Each DEPARTMENT may be responsible for one or more EMPLOYEES


Full Reading of Relationship

assigned to
EMPLOYEE DEPARTMENT
responsible for

Each EMPLOYEE must be assigned to one and only one DEPARTMENT

Each DEPARTMENT may be responsible for one or more EMPLOYEES


How do you read this?

enrolled in
STUDENT COURSE
taken by
How do you read this?

enrolled in
STUDENT COURSE
taken by

Each STUDENT may be enrolled in one or more COURSES

Each COURSE may be taken by one or more STUDENTS


Analyzing and 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
Oracle’s Layout Guidelines

Child Parent
Entity Entity (1)

Dead Crows Fly East !


Parent
Entity (2)
Attributes
Badge 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 Attributes

Is this attribute really needed ?

Beware of obsolete requirements from previous systems

Beware of derived data


Attribute Diagramming
Conventions
• Inside the entity's
EMPLOYEE soft box
badge num

• Singular
first name
last name
payroll num
date of birth
employment status • Lowercase
Meaningful Components
PERSON PERSON
last name
name first name

Break down aggregate attributes

ITEM ITEM
type
code vendor
num
Verify for Single Value
RENTAL
transaction date
total amount paid
Can an attribute have more
item than one value for one
instance of the entity?

Yes, more than one item may be rented at a time.


An entity is missing.
RENTAL ITEM RENTAL
item num transaction date
total amount paid
Attributes Which have
TITLE
Attributes
product code Does information need to be
title stored about any of the
description
review details attributes?

Yes, review details. An entity is missing.

REVIEW TITLE
product code
author title
comment description
date recorded review details
Finding Common or Derived
Data
• Count
• Total
• Maximum, Minimum, Average
• Calculation

Derived attributes are redundant and


can lead to inconsistent values
Attribute Optionality
Mandatory Attributes
• A value must be stored for each entity instance
• Tagged with
*
Optional Attributes
• A value may be stored for each entity
instance

• Tagged with o
Attribute Optionality

EMPLOYEE

badge num
* first name
* last name
*o title
o weight
Attribute Details and
Volumes

Attribute - * Engine Size


Format Type Number
Maximum length 4
Average length 4
Decimal place 1
Unit of measure cc
Allowable values 900,1000,1500,1800,2000

Volume Initial 100%


Using a Domain
Movie
Mono

AUDIO
Stereo
MON
Audio STE
SUR
Game

Surround

Sound
Creating an Entity

For DB Planning
Adding Details
Domains
Creating Relationships
Diagrammer Behavior
• Definition changes are stored in
Repository even if the diagram is
not saved.
• Saving a diagram saves the layout.
• Diagrams are not synchronized
automatically.
• Requerying is your responsibility.
• Diagrams can be exported to, for
example, Word documents.
Editing in the RON

Potrebbero piacerti anche