Sie sind auf Seite 1von 10

Modeling Data in the

Organization

Instructor: Dr. Atif Khan

1
E-R model
 The E-R model remains the mainstream approach for
conceptual data modeling.
 Its popularity stems from factors such as relative ease of use.
 The E-R model is most often used as a tool for
communications between database designers and end users
during the analysis phase of database development.
 The E-R model is used to construct a conceptual data model,
which is a representation of the structure and constraints of a
database that is independent of the software (such as a
database management system) and its associated data model
that will be used to implement the database.

2
E-R model
 An entity-relationship model (or E-R model) is a detailed,
logical representation of the data for an organization or for a
business area.
 The E-R model is expressed in terms of entities in the business
environment, the relationships (or associations) among those
entities, and the attributes (or properties) of both the entities
and their relationships.
 An E-R model is normally expressed as an entity-relationship
diagram (or E-R diagram, or simply ERD), which is a graphical
representation of an E-R model.

Chapter 3 © 2007 by Prentice Hall 3


Entities
An entity is a person, place, object, event, or concept in the
user environment about which the organization wishes to
maintain data.
Thus, an entity has a noun name.
Some examples of each of these kinds of entities follow:
Person: EMPLOYEE, STUDENT, PATIENT
Place: STORE, WAREHOUSE, STATE
Object: MACHINE, BUILDING, AUTOMOBILE
Event: SALE, REGISTRATION, RENEWAL
Concept: ACCOUNT, COURSE, WORK CENTER

Chapter 3 © 2007 by Prentice Hall 4


Entity Type Versus Entity Instance
 An entity type is a collection of entities that share common properties or
characteristics. For example: STUDENT entity type represents set of all
students. Likewise, BOOK entity type is a collection of all books etc.
 Each entity type in an E-R model is given a name.
 Because the name represents a collection (or set) of items, it is always singular.
 We use capital letters for names of entity type(s). In an E-R diagram, the entity
name is placed inside the box representing the entity type.
 An entity instance is a single occurrence of an entity type.

 An entity type is described just once (using metadata) in a database, whereas


many instances of that entity type may be represented by data stored in the
database.

 For example, there is one EMPLOYEE entity type in most organizations, but
there may be hundreds (or even thousands) of instances of this entity type
stored in the database.
Chapter 3 © 2007 by Prentice Hall 5
Chapter 3 © 2007 by Prentice Hall 6
Basic E-R notation (Figure 3-2)

Entity
Attribute
symbols
symbols

A special entity
that is also a Relationship
relationship symbols

Relationship
degrees specify
number of
entity types Relationship
involved cardinalities
specify how
many of each
entity type is
allowed
Chapter 3 © 2007 by Prentice Hall 7
What Should an Entity Be?
 SHOULD BE:
 An object/entity that will have many
instances in the database
 An object that will be composed of multiple
attributes
 An object that we are trying to model
 SHOULD NOT BE:
 A user of the database system
 An output of the database system (e.g., a
report)
Chapter 3 © 2007 by Prentice Hall 8
Figure 3-4 Example of inappropriate entities

System System
user Inappropriate output
entities

Appropriate
entities

Chapter 3 © 2007 by Prentice Hall 9


 In this situation, the treasurer manages accounts, receives expense
reports, and records expense transactions against each account.
 However, do we need to keep track of data about the Treasurer (the

TREASURER entity type) and her supervision of accounts (the Manages


relationship) and receipt of reports (the Receives relationship)?
 The Treasurer is the person entering data about accounts and expenses

and receiving expense reports. That is, he is a user of the database.


 Because there is only one Treasurer, TREASURER data do not need to be

kept.
 Further, is the EXPENSE REPORT entity necessary?

 Because an expense report is computed from expense transactions and

account balances.
 It is the result of extracting data from the database and received by the

Treasurer.
 Even though there will be multiple instances of expense reports given to

the Treasurer over time, data needed to compute the report contents
each time are already represented by the ACCOUNT and EXPENSE entity
types.
Chapter 3 © 2007 by Prentice Hall 10

Das könnte Ihnen auch gefallen