copyright oracle corporation, 1999. all rights reserved. 11 ® introduction to entities,...
TRANSCRIPT
Copyright Oracle Corporation, 1999. All rights reserved.
1111
®
Introduction to Entities, Attributes, and Relationships
Introduction to Entities, Attributes, and Relationships
Section 02 – Lessons 1,2,3 Section 02 – Lessons 1,2,3
• Use the student note section below for further Use the student note section below for further explanation of the slide content.explanation of the slide content.
• Use your mouse to resize the content pane and Use your mouse to resize the content pane and read all of the student note section.read all of the student note section.
1-1-22 Copyright Oracle Corporation, 1999. All rights reserved.®
OverviewOverview
• Why conceptual modeling?
• Introduction of the Key role players:
– Entities
– Attributes
– Relationships
• Why conceptual modeling?
• Introduction of the Key role players:
– Entities
– Attributes
– Relationships
1-1-33 Copyright Oracle Corporation, 1999. All rights reserved.®
Why Create a Conceptual Model?Why Create a Conceptual Model?
• It describes exactly the information needs of the It describes exactly the information needs of the businessbusiness
• It facilitates discussionIt facilitates discussion
• It helps to prevent mistakes, misunderstandingIt helps to prevent mistakes, misunderstanding
• It forms important “ideal system” documentationIt forms important “ideal system” documentation
• It forms a sound basis for physical database It forms a sound basis for physical database designdesign
• It is a very good practice with many practitionersIt is a very good practice with many practitioners
• It describes exactly the information needs of the It describes exactly the information needs of the businessbusiness
• It facilitates discussionIt facilitates discussion
• It helps to prevent mistakes, misunderstandingIt helps to prevent mistakes, misunderstanding
• It forms important “ideal system” documentationIt forms important “ideal system” documentation
• It forms a sound basis for physical database It forms a sound basis for physical database designdesign
• It is a very good practice with many practitionersIt is a very good practice with many practitioners
1-1-44 Copyright Oracle Corporation, 1999. All rights reserved.®
Between Dream and Reality...Between Dream and Reality...
1-1-55 Copyright Oracle Corporation, 1999. All rights reserved.®
Dream and Reality - ActivityDream and Reality - Activity
Directions:
• Working in pairs, one student describes his/her "dream house" while the other student attempts to draw it. The pairs can discuss specific details but, the student describing the house is not allowed to see what is being drawn until after time is called.
Assessment:
• Ask volunteer student pairs to describe the discrepancies between what they thought was being described and what was actually drawn.
Directions:
• Working in pairs, one student describes his/her "dream house" while the other student attempts to draw it. The pairs can discuss specific details but, the student describing the house is not allowed to see what is being drawn until after time is called.
Assessment:
• Ask volunteer student pairs to describe the discrepancies between what they thought was being described and what was actually drawn.
1-1-66 Copyright Oracle Corporation, 1999. All rights reserved.®
Entity Relationship ModelingEntity Relationship Modeling
• Models business,not implementation
• Is a well-established technique
• Has a robust syntax
• Results in easy-to-read diagrams…
...although they maylook rather complex at first sight
• Models business,not implementation
• Is a well-established technique
• Has a robust syntax
• Results in easy-to-read diagrams…
...although they maylook rather complex at first sight
SUPPLIER# SUPPLIER CODEo EMAIL* APPROVED* REFERENCE
OTHER ORGANIZATION
ORGANIZATIONo EMAIL* NAMEo POSTAL CODEo REGIONo STREETo TOWNo TELEPHONE NUMBERo CONTACT NAMEo CONTACT EXTENSION
MEMBERSHIP TYPE# CODE* DESCRIPTION* DISCOUNT PERCENTAGEo STANDARD FEE
MEMBERSHIP PERIOD# START DATEo ACTUAL FEE PAID
MEMBERSHIP# NUMBERo TERMINATION REASONo TERMINATION DATE
EMPLOYEE* POSITION* LAST NAMEo FIRST NAMEo OTHER INITIALSo EMAIL
BOOKING* BOOK DATEo EXPIRE DATEo NOTIFY DATEo RESERVE DATEo STAFF REMARKS
RENTAL ITEM# LINE NO* RENTAL PERIOD* PRICE PAIDo RETURN DATEo STAFF REMARKS
RENTAL* RENTAL DATEo STAFF REMARKSo COMPLETED
COPY* ACQUIRE DATE* PURCHASE COST* SHELF CODEo CONDITIONo CUSTOMER REMARKS...
REVIEW# SEQUENCE* ARTICLE* HOTo AUTHORo URL
PUBLICATION# REFERENCE* TITLEo VOLUMEo ISSUEo PUBLISH DATE
CUSTOMERo EMAIL* DESIGNATION* FIRST NAME* LAST NAMEo OTHER INITIALS* STREET* TOWN* POSTAL CODE* REGIONo HOME PHONEo WORK EXTENSIONo WORK PHONEo PHOTOGRAPHo STAFF REMARKS
CATALOG# REFERENCEo CATALOG DATEo DESCRIPTION
MOVIE* CATEGORYo AGE RATING* DURATION* MONOCHROMEo AUDIOo PREVIEW
GAME* CATEGORY* MEDIUMo MINIMUM MEMORY
TITLE# PRODUCT CODE* TITLEo DESCRIPTION
PRICE LEVEL# CODE* DESCRIPTION
PRICE HISTORY# EFFECTIVE DATE* PRICE* DEFAULT DAYS* OVERDUE RATE
for
used for
of
renewed for
of
the type of
held by
the holder of
held by
the holder of
availablefrom
thedistributor for
requestedagainst the
requestorof
authorized by
responsiblefor
the reservation for
reserved on
for
on
cancelled by
the cancellor of
approved by
responsible for
of
reviewed in
at
applied to
the rental for
fulfilled as
part of
composed of
for
rented on
approved by
responsiblefor
part of
parent organization of
acquired from
the source of
of
available as
for
defined by
managed by
the manager of
in
the source of
in
the source of
1-1-77 Copyright Oracle Corporation, 1999. All rights reserved.®
Goals of Entity Relationship ModelingGoals of Entity Relationship Modeling
• Capture all required information
• Information appears only once
• Model no information that is derivable from other information already modeled
• Information is in a predictable, logical place
• Capture all required information
• Information appears only once
• Model no information that is derivable from other information already modeled
• Information is in a predictable, logical place
1-1-88 Copyright Oracle Corporation, 1999. All rights reserved.®
Database TypesDatabase Types
HierarchicalHierarchical
RelationalRelational
NetworkNetwork
ER ModelER Model
1-1-99 Copyright Oracle Corporation, 1999. All rights reserved.®
EntityEntity
• An Entity is:
– “Something” of significance to the business about which data must be known.
– A name for the things that you can list.
– Usually a noun.
• Examples: objects, events
• Entities have instances.
• An Entity is:
– “Something” of significance to the business about which data must be known.
– A name for the things that you can list.
– Usually a noun.
• Examples: objects, events
• Entities have instances.
1-1-1010 Copyright Oracle Corporation, 1999. All rights reserved.®
Entities and InstancesEntities and Instances
PERSON
PRODUCT
PRODUCT TYPE
EMPLOYMENT CONTRACT
JOB
SKILL LEVEL
TICKET RESERVATION
PURCHASE
ELECTION
PRINTER PREFERENCE
DOCUMENT VERSION
PERSON
PRODUCT
PRODUCT TYPE
EMPLOYMENT CONTRACT
JOB
SKILL LEVEL
TICKET RESERVATION
PURCHASE
ELECTION
PRINTER PREFERENCE
DOCUMENT VERSION
Mahatma Gandhi
2.5 x 35 mm copper nail
nail
my previous contract
violinist
fluent
tonight: Hamlet in the Royal
the CD I bought yesterday
for parliament next fall
…
...
Mahatma Gandhi
2.5 x 35 mm copper nail
nail
my previous contract
violinist
fluent
tonight: Hamlet in the Royal
the CD I bought yesterday
for parliament next fall
…
...
1-1-1111 Copyright Oracle Corporation, 1999. All rights reserved.®
Entities and SetsEntities and Sets
dish washerdish washer
JOB
waiterwaiter
cookcookwaitresswaitress
managermanager
financial controllerfinancial controller
porterporter
piano playerpiano player
• An entity represents a set of instances that are of interest to a particular business.
• An entity represents a set of instances that are of interest to a particular business.
1-1-1212 Copyright Oracle Corporation, 1999. All rights reserved.®
AttributeAttribute
• Also represents something of significance to the business
• Is a single valued property detail of an entity
• Is a specific piece of information that:
– Describes
– Quantifies
– Qualifies
– Classifies
– Specifies
an entity.
• Also represents something of significance to the business
• Is a single valued property detail of an entity
• Is a specific piece of information that:
– Describes
– Quantifies
– Qualifies
– Classifies
– Specifies
an entity.
1-1-1313 Copyright Oracle Corporation, 1999. All rights reserved.®
Attribute ExamplesAttribute Examples
Entity
EMPLOYEE
CAR
ORDER
JOB
TRANSACTION
EMPLOYMENT CONTRACT
Entity
EMPLOYEE
CAR
ORDER
JOB
TRANSACTION
EMPLOYMENT CONTRACT
Attribute
Family Name, Age, Shoe Size,
Town of Residence, Email, ...
Model, Weight, Catalog Price, …
Order Date, Ship Date, …
Title, Description, ...
Amount, Transaction Date, …
Start Date, Salary, ...
Attribute
Family Name, Age, Shoe Size,
Town of Residence, Email, ...
Model, Weight, Catalog Price, …
Order Date, Ship Date, …
Title, Description, ...
Amount, Transaction Date, …
Start Date, Salary, ...
1-1-1414 Copyright Oracle Corporation, 1999. All rights reserved.®
Practice ExercisesPractice Exercises
Complete the following Practice Exercises in class:
• 1-1 "Instance or Entity"
• 1-2 "Guest"
Complete the following Practice Exercises in class:
• 1-1 "Instance or Entity"
• 1-2 "Guest"
1-1-1515 Copyright Oracle Corporation, 1999. All rights reserved.®
RelationshipsRelationships
• Also represent something of significance to the business
• Express how entities are mutually related
• Always exist between two entities (or one entity twice)
• Always have two perspectives
• Are named at both ends
• Also represent something of significance to the business
• Express how entities are mutually related
• Always exist between two entities (or one entity twice)
• Always have two perspectives
• Are named at both ends
1-1-1616 Copyright Oracle Corporation, 1999. All rights reserved.®
Relationship ExamplesRelationship Examples
EMPLOYEES have JOBS
JOBS are held by EMPLOYEES
EMPLOYEES have JOBS
JOBS are held by EMPLOYEES
PRODUCTS are classified by a PRODUCT TYPE
PRODUCT TYPE is a classification for a PRODUCT
PRODUCTS are classified by a PRODUCT TYPE
PRODUCT TYPE is a classification for a PRODUCT
PEOPLE make TICKET RESERVATIONS
TICKET RESERVATIONS are made by PEOPLE
PEOPLE make TICKET RESERVATIONS
TICKET RESERVATIONS are made by PEOPLE
1-1-1717 Copyright Oracle Corporation, 1999. All rights reserved.®
JOB
waiterwaiter
cookcookwaitresswaitress
managermanager
financial controllerfinancial controller
porterporter
piano playerpiano player
Employees have JobsEmployees have Jobs
AhmedAhmed
JillJillAdamAdam
MariaMaria
EMPLOYEEEMPLOYEE
Numerical observation:
• All EMPLOYEES have a JOB
• No EMPLOYEE has more than one JOB
• Not all JOBS are held by an EMPLOYEE
• Some JOBS are held by more than one EMPLOYEE
Numerical observation:
• All EMPLOYEES have a JOB
• No EMPLOYEE has more than one JOB
• Not all JOBS are held by an EMPLOYEE
• Some JOBS are held by more than one EMPLOYEE
ShintaroShintaro dish washerdish washer
1-1-1818 Copyright Oracle Corporation, 1999. All rights reserved.®
Entity Representation in DiagramEntity Representation in Diagram
• Drawn as a “softbox”
• Name singular
• Name inside
• Neither size, nor position has a special meaning
• Drawn as a “softbox”
• Name singular
• Name inside
• Neither size, nor position has a special meaning
EMPLOYEE
TICKETRESERVATION
JOB ASSIGNMENT
JOB
ORDERE
LEC
TIO
N
During design, entities usually lead to tables.
1-1-1919 Copyright Oracle Corporation, 1999. All rights reserved.®
Attributes in DiagramsAttributes in Diagrams
*o
EMPLOYEE Family Name Addresso Birth Dateo Shoe Sizeo Email
JOB Titleo Description
During design, attributes lead to columns.
*
*
*
Mandatory attribute, that is, known and available for every instance
Optional attribute, that is, unknown or unimportant to know for some instances
1-1-2020 Copyright Oracle Corporation, 1999. All rights reserved.®
Jobs are held by one or more employees
An employee has exactly one jobAn employee has exactly one jobhas
Relationship in DiagramsRelationship in Diagrams
EMPLOYEE JOB has
held by
held by
exactly one
one or more
During design, relationships lead to foreign keys.
1-1-2323 Copyright Oracle Corporation, 1999. All rights reserved.®
EMPLOYEE JOB
Two PerspectivesTwo Perspectives
hashas
held byheld by
mandatory:mandatory:mandatory:mandatory: optional:optional:optional:optional:
1-1-2424 Copyright Oracle Corporation, 1999. All rights reserved.®
Every EMPLOYEE has one and only one JOB
One WayOne Way
hashasEMPLOYEE JOB
held byheld by
mandatory:mandatory:mandatory:mandatory: optional:optional:optional:optional:
1-1-2525 Copyright Oracle Corporation, 1999. All rights reserved.®
The Other WayThe Other Way
hashasEMPLOYEE JOB
held byheld by
mandatory:mandatory:mandatory:mandatory: optional:optional:optional:optional:
A JOB may be held by one or more EMPLOYEES
1-1-2626 Copyright Oracle Corporation, 1999. All rights reserved.®
””““EachEach PP split intosplit intomust bemust be
may bemay be one or more Qsone or more QsOne and only one QOne and only one Q
““EachEach P P may be may be split intosplit into one or more one or more Qs Qs””
Reading a Relationship EndReading a Relationship End
P split intosplit into Qpart ofpart of
1-1-2727 Copyright Oracle Corporation, 1999. All rights reserved.®
““EachEach QQ part ofpart of ””must bemust be
may bemay be one or more Psone or more PsOne and only one POne and only one P
““EachEach Q Q must be must be part of part of exactly oneexactly one P P””
Reading a Relationship EndReading a Relationship End
P split intosplit into Qpart ofpart of
1-1-2828 Copyright Oracle Corporation, 1999. All rights reserved.®
““EachEach P P may be may be split intosplit into one or more one or more Qs Qs””
““EachEach Q Q must be must be part of part of exactly oneexactly one P P””
Reading a Relationship EndReading a Relationship End
P split intosplit into Qpart ofpart of
1-1-2929 Copyright Oracle Corporation, 1999. All rights reserved.®
Functions Drive DataFunctions Drive Data
• Business functions are always present.
– Explicit
– Assumed
• Business functions need data.
• An entity, attribute, or relationship may be modeled because:
– It is used by a business function.
– The business need may arise in the near future.
• Business functions are always present.
– Explicit
– Assumed
• Business functions need data.
• An entity, attribute, or relationship may be modeled because:
– It is used by a business function.
– The business need may arise in the near future.
1-1-3030 Copyright Oracle Corporation, 1999. All rights reserved.®
Weather ForecastWeather Forecast
KøbenhavnBremenBerlinMünchenAmsterda
mBruxellesParisBordeaux
1/-5
7/2
3/-1
8/3
5/-3
4/0
4/1
0/-3
January 263
3
3
4
3
2
3
4
****
1-1-3131 Copyright Oracle Corporation, 1999. All rights reserved.®
(Copenhagen)
Bremen
Berlin
(Munich)
Bruxelles
Paris
Bordeaux
Amsterdam
UKUK
FRFR
DEDE
DKDK
CHCH
NLNL
BEBE
ITIT
LULU
IRIR
København
München
(Brussels)
1-1-3232 Copyright Oracle Corporation, 1999. All rights reserved.®
located in
having
referring to
referred in
about
Weather Forecast, a Solution Weather Forecast, a Solution
WEATHER TYPE* Icon* Description
WIND DIRECTION* Icon* Description
COUNTRY* Nameo Geographical Position
CITY* Nameo Geographical Position
FORECAST* Dateo Minimum Temperatureo Maximum Temperatureo Wind Force
referring to
referred in
subject of
1-1-3333 Copyright Oracle Corporation, 1999. All rights reserved.®
Graphical Elements of ER DiagramGraphical Elements of ER Diagram
SubtypeSubtype
##
Unique identifierUnique identifier
ArcArcArcArc
NontransferabilityNontransferabilityNontransferabilityNontransferability
** **o
o
EntityEntity
AttributeAttribute
RelationshipRelationship
1-1-3434 Copyright Oracle Corporation, 1999. All rights reserved.®
SummarySummary
• ER Modeling models information conceptually
• Based on functional business needs
• ER Modeling focuses on “what” a business is doing. Not necessarily the “how”
• Diagrams provide easy means of communication
• Detailed, but not too much
• IN CLASS - Complete the Practice Exercises
• IN CLASS and ONLINE Complete the Quiz for this Chapter.
• ER Modeling models information conceptually
• Based on functional business needs
• ER Modeling focuses on “what” a business is doing. Not necessarily the “how”
• Diagrams provide easy means of communication
• Detailed, but not too much
• IN CLASS - Complete the Practice Exercises
• IN CLASS and ONLINE Complete the Quiz for this Chapter.