0% found this document useful (0 votes)
60 views31 pages

Modeling Data in The Organization: Abasyn University, Peshawar 1

The document provides an overview of entity-relationship (E-R) modeling. It defines key concepts in E-R modeling including entities, attributes, relationships, cardinality constraints, and E-R diagrams. Entities represent objects in the domain being modeled, such as people, places, or concepts. Relationships define associations between entities. Attributes provide additional information about entities and relationships. The document gives examples of how to model different entity types and relationships between entities using an E-R diagram.

Uploaded by

roohullahzeshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views31 pages

Modeling Data in The Organization: Abasyn University, Peshawar 1

The document provides an overview of entity-relationship (E-R) modeling. It defines key concepts in E-R modeling including entities, attributes, relationships, cardinality constraints, and E-R diagrams. Entities represent objects in the domain being modeled, such as people, places, or concepts. Relationships define associations between entities. Attributes provide additional information about entities and relationships. The document gives examples of how to model different entity types and relationships between entities using an E-R diagram.

Uploaded by

roohullahzeshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

Modeling Data in the Organization

.
Abasyn University, Peshawar 1
THE E-R MODEL: AN OVERVIEW
• An entity-relationship model (E-R model) is a
detailed, conceptual representation of the data for an
organization or 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 (E-R diagram, or ERD), which
is a graphical representation of an E-R model.

Abasyn University, Peshawar 2


E-R Model Notation

Abasyn University, Peshawar 3


MODELING ENTITIES AND
ATTRIBUTES
• The basic constructs of the E-R model are:
– entities,
– relationships, and
– attributes

Abasyn University, Peshawar 4


Entities
• An entity is a person, a place, an object, an event,
or a 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

Abasyn University, Peshawar 5


Entity Instance
– An entity instance is a single occurrence of an
entity type.

Abasyn University, Peshawar 6


STRONG VERSUS WEAK ENTITY
TYPES
• Strong entity
– An entity that exists independently of other entity types.
– Instances of a strong entity type always have a unique characteristic
(called an identifier)—that is, an attribute or a combination of
attributes that uniquely distinguish each occurrence of that entity.
• Weak entity
– An entity type whose existence depends on some other entity type.
– A weak entity type does not typically have its own identifier.
– Example:
• EMPLOYEE is a strong entity type with identifier Employee ID (we note
the identifier attribute by underlining it). DEPENDENT is a weak entity
type, as indicated by the double-lined rectangle.

Abasyn University, Peshawar 7


Attributes
• Each entity type has a set of attributes
associated with it.
• An attribute is a property or characteristic of
an entity type that is of interest to the
organization.
– Following are some typical entity types and their
associated attributes:

Abasyn University, Peshawar 8


REQUIRED VERSUS OPTIONAL
ATTRIBUTES
• Required attribute
– An attribute that must have a value for every entity
(or relationship) instance with which it is
associated.
• Optional attribute
– An attribute that may not have a value for every
entity (or relationship) instance with which it is
associated.

Abasyn University, Peshawar 9


REQUIRED VERSUS OPTIONAL
ATTRIBUTES

Abasyn University, Peshawar 10


SIMPLE VERSUS COMPOSITE
ATTRIBUTES
• Simple (or atomic) attribute
– An attribute that cannot be broken down into smaller
components that are meaningful to the organization.
• Composite attribute
– An attribute that has meaningful component parts (attributes).
– Common examples are Name and Address, which can usually
be broken down into the following component attributes:
• First Name, Middle Name, Last Name
• Street Address, City, State, and Postal Code.
• Most drawing tools do not have a notation for composite
attributes, so you simply list all the component parts.

Abasyn University, Peshawar 11


SINGLE-VALUED VERSUS
MULTIVALUED ATTRIBUTES
• Multivalued attribute
– An attribute that may take on more than one value
for a given entity (or relationship) instance.

Abasyn University, Peshawar 12


STORED VERSUS DERIVED
ATTRIBUTES
• Derived attribute
– An attribute whose values can be calculated from
related attribute values (plus possibly data not in
the database, such as today’s date, the current time,
or a security code provided by a system user).
• We indicate a derived attribute in an E-R
diagram by using square brackets around the
attribute name, as shown in Figure (on previous
slide) for the Years Employed attribute.
Abasyn University, Peshawar 13
IDENTIFIER ATTRIBUTE
• Identifier
– An identifier is an attribute (or combination of
attributes) whose value distinguishes instances of
an entity type.

Abasyn University, Peshawar 14


MODELING RELATIONSHIPS
• Relationships are the glue that holds together
the various components of an E-R model.
• Intuitively, a relationship is an association
representing an interaction among the instances
of one or more entity types that is of interest to
the organization.
• To understand relationships more clearly, we
must distinguish between relationship types and
relationship instances
Abasyn University, Peshawar 15
Basic Concepts and Definitions in
Relationships
• Relationship
– A meaningful association between (or among)
entity types.
• Relationship instance
• An association between (or among) entity
instances where each relationship instance
associates exactly one entity instance from
each participating entity type.

Abasyn University, Peshawar 16


ASSOCIATIVE ENTITIES
• Associative entity
– An entity type that associates the instances of one
or more entity types and contains attributes that are
peculiar to the relationship between those entity
instances.

Abasyn University, Peshawar 17


Degree of a Relationship
• The degree of a relationship is the number of
entity types that participate in that relationship.
• The three most common relationship degrees in
E-R models are
– unary (degree 1),
– binary (degree 2), and
– ternary (degree 3)
• Higher degree relationships are possible, but
they are rarely encountered in practice.
Abasyn University, Peshawar 18
UNARY RELATIONSHIP
• A unary relationship is a relationship
between the instances of a single entity type.
(Unary relationships are also called recursive
relationships.)

Abasyn University, Peshawar 19


BINARY RELATIONSHIP
• A binary relationship is a relationship
between the instances of two entity types and
is the most common type of relationship
encountered in data

Abasyn University, Peshawar 20


TERNARY RELATIONSHIP
• A ternary relationship is a simultaneous
relationship among the instances of three
entity types.

Abasyn University, Peshawar 21


Cardinality Constraints
• A rule that specifies the number of instances of
one entity that can (or must) be associated with
each instance of another entity.

Abasyn University, Peshawar 22


Cardinality Constraints
• Minimum cardinality
– The minimum number of instances of one entity
that may be associated with each instance of
another entity.
• Maximum cardinality
– The maximum number of instances of one entity
that may be associated with each instance of
another entity.

Abasyn University, Peshawar 23


Examples of ERDs
• 1. PATIENT Has Recorded PATIENT HISTORY (Figure 2-17a) Each
patient has one or more patient histories. (The initial patient visit is always
recorded as an instance of PATIENT HISTORY.) Each instance of PATIENT
HISTORY “belongs to” exactly one PATIENT.

• 2. EMPLOYEE Is Assigned To PROJECT (Figure 2-17b) Each PROJECT


has at least one EMPLOYEE assigned to it. (Some projects have more than
one.) Each EMPLOYEE may or (optionally) may not be assigned to any
existing PROJECT (e.g., employee Pete), or may be assigned to one or more
PROJECTs.

• 3. PERSON Is Married To PERSON (Figure 2-17c) This is an optional zero


or one cardinality in both directions, because a person may or may not be
married at a given point in time.

Abasyn University, Peshawar 24


Examples of ERDs

Abasyn University, Peshawar 25


1. A SUPPLIER may supply many ITEMs (by “may supply,” we mean the supplier may
not supply any items). Each ITEM is supplied by any number of SUPPLIERs (by “is
supplied,” we mean that the item must be supplied by at least one supplier).

2. Each ITEM must be used in the assembly of at least one PRODUCT and may be used in
many products. Conversely, each PRODUCT must use one or more ITEMs.

3. ASUPPLIER may send many SHIPMENTs. However, each shipment must be sent
by exactly one SUPPLIER. Notice that sends and supplies are separate concepts.
A SUPPLIER may be able to supply an item, but may not yet have sent any shipments of that
item.

4. A SHIPMENT must include one (or more) ITEMs. An ITEM may be included on
several SHIPMENTs.

5. ACUSTOMER may submit any number of ORDERs. However, each ORDER must
be submitted by exactly one CUSTOMER. Given that a CUSTOMER may not have
submitted any ORDERs, some CUSTOMERs must be potential, inactive, or some
other customer possibly without any related ORDERs.

6. An ORDER must request one (or more) PRODUCTs. A given PRODUCT may not
be requested on any ORDER, or may be requested on one or more orders.
10/8/21 Abasyn University, Peshawar 26
10/8/21 Abasyn University, Peshawar 27
FIGURE 2-22 Data model for Pine Valley
Furniture Company in Microsoft Visio notation

Abasyn University, Peshawar 28


Exercise
• Figure 2-25 shows a
grade report that is
mailed to students at the
end of each semester.
Prepare an ERD
reflecting the data
contained in the grade
report. Assume that
each course is taught by
one instructor. Explain
what you chose for the
identifier of each entity
type on your ERD.

Abasyn University, Peshawar 29


Exercise
• A hospital has a large number of registered physicians. Attributes of
PHYSICIAN include Physician ID (the identifier) and Specialty. Patients are
admitted to the hospital by physicians. Attributes of PATIENT include Patient
ID (the identifier) and Patient Name. Any patient who is admitted must have
exactly one admitting physician. A physician may optionally admit any
number of patients. Once admitted, a given patient must be treated by at least
one physician. A particular physician may treat any number of patients, or
may not treat any patients. Whenever a patient is treated by a physician, the
hospital wishes to record the details of the treatment (Treatment Detail).
Components of Treatment Detail include Date, Time, and Results.
• Does your ERD allow for the same patient to be admitted by different
physicians over time?
• How would you include on the ERD the need to represent the date on which
a patient is admitted for each time they are admitted?

Abasyn University, Peshawar 30


THE END

Abasyn University, Peshawar 31

You might also like