You are on page 1of 11

CS 4002

Unit 2 – Part a

Ankur Verma 3/28/22 Data Modelling using ER Model


CS 4002 Unit 2- Data Modeling using ER Model (Part a)

Table of Contents
1) OVERVIEW OF THE DESIGN PROCESS ........................................................................................................ 1
• Design Phases ....................................................................................................................................................... 1
o Requirements Analysis .................................................................................................................................... 1
o Conceptual Database Design ........................................................................................................................... 2
o Logical Database Design.................................................................................................................................. 2
2) THE ENTITY RELATIONSHIP MODEL (ER MODEL) ................................................................................. 3
• E-R Diagram: ....................................................................................................................................................... 3
• E-R Diagram Notation: ....................................................................................................................................... 3
• Entity ..................................................................................................................................................................... 4
• Entity Type ........................................................................................................................................................... 4
• Entity Set............................................................................................................................................................... 4
• Entity v/s Entity Type v/s Entity Set .................................................................................................................. 4
• Attributes .............................................................................................................................................................. 5
• Relationship .......................................................................................................................................................... 5
• Relationship Sets .................................................................................................................................................. 7
3) COMPLEX ATTRIBUTES ................................................................................................................................... 8
• Domain/Value Set................................................................................................................................................. 8
• Simple Attributes ................................................................................................................................................. 8
• Composite Attributes ........................................................................................................................................... 8
• Single-valued Attributes ...................................................................................................................................... 9
• Multi-valued Attributes ....................................................................................................................................... 9
• Derived Attributes.............................................................................................................................................. 10

----------------------------------------------------------------------------------------------------------------
1) OVERVIEW OF THE DESIGN PROCESS
• The task of creating a database application is a complex one, involving design of the
database schema, design of the programs that access and update the data, and design
of a security scheme to control access to data.
• The needs of the users play a central role in the design process.
• Design Phases
o The database design process can be divided into six steps.
o The ER model is most relevant to the first three steps :-
o Requirements Analysis
▪ The very first step in designing a database application is to understand what
data is to be stored in the database, what applications must be built on top

Page 1
CS 4002 Unit 2- Data Modeling using ER Model (Part a)

of it, and what operations are most frequent and subject to performance
requirements.
▪ In other words, we must find out what the users want from the database
o Conceptual Database Design
▪ The information gathered in the requirements analysis step is used to
develop a high-level description of the data to be stored in the database,
along with the constraints that are known to hold over this data.
o Logical Database Design
▪ We must choose DBMS to implement our database design, and convert the
conceptual database design into a database schema in the data model of the
chosen DBMS.
▪ We will only consider relational DBMSs, and therefore, the task in the
logical design step is to convert an ER schema into a relational database
schema.

Page 2
CS 4002 Unit 2- Data Modeling using ER Model (Part a)

2) THE ENTITY RELATIONSHIP MODEL (ER MODEL)


• The entity-relationship (E-R) data model was developed to facilitate database design
by allowing specification of an enterprise schema that represents the overall logical
structure of a database.
• The E-R model is very useful in mapping the meanings and interactions of real-world
enterprises onto a conceptual schema.
• Because of this usefulness, many database design tools draw on concepts from the E-
R model.
• The E-R data model employs three basic concepts: entity sets, relationship sets, and
attributes.
• E-R Diagram:
o The E-R model also has an associated diagrammatic representation, an E-R
diagram can express the overall logical structure of a database graphically.
o E-R diagrams are simple and clear—this account in the widespread use of the E-
R model.
• E-R Diagram Notation:
o

Component Symbol

Entity

Relationship

Attribute

Multivalued-Attribute

Key-Attribute

Derived Attribute

Page 3
CS 4002 Unit 2- Data Modeling using ER Model (Part a)

Composite Attribute

Weak Entity

Weak Entity
Or
Identifying Relationship

• Entity
o An entity is an object in the real world that is distinguishable from other objects.
or
o The basic concept that the ER model represents is an entity, which is a thing or
object in the real world with an independent existence.
• Entity Type
o Tangible Entity: An Entity may be an object with a physical existence – a
particular person, car, house, or employee
Ex:- A student with a particular roll number is an entity.
o Intangible: An Entity may be an object with a conceptual existence – a
company, a job, or a university course.
Ex:- A company with a particular registration number is an entity.
• Entity Set
o A collection of entity is called an entity set.
o All entities in a given entity set have the same attributes.
o Entity sets need not be disjoint; the collection of toy department employees and
the collection of appliance department employees may both contain employee
John Doe (who happens to work in both departments).
• Entity v/s Entity Type v/s Entity Set
Entity Entity Type Entity Set

A thing in the real world with A category of a particular Set of all entities of a
independent existence entity particular entity type.

Page 4
CS 4002 Unit 2- Data Modeling using ER Model (Part a)

Entity Entity Type Entity Set

Any particular row (a record) in The name of a relation All rows of a relation
a relation(table) is known as an (table) in RDBMS is an (table) in RDBMS is
entity. entity type entity set

• Attributes
o An entity is described using a set of attributes.
or
o Each entity has attributes—the properties that describe it.
o For each attribute associated with an entity set, we must identify a domain of
possible values.
o Example :- the domain associated with the attribute name of Employees might be
the set of 40-character strings.
• Relationship
o A relationship is an association among two or more entities.
o In Figure below there are several implicit relationships among the various entity
types. In fact, whenever an attribute of one entity type refers to another entity
type, some relationship exists.
o For example,
▪ the attribute Manager of DEPARTMENT refers to an employee who manages
the department;
▪ the attribute Controlling_department of PROJECT refers to the
department that controls the project.

Page 5
CS 4002 Unit 2- Data Modeling using ER Model (Part a)

Page 6
CS 4002 Unit 2- Data Modeling using ER Model (Part a)

o A relation can also have descriptive attributes.


▪ They are used to record information about the relationship, rather than
about any one of the participating entities.
▪ For example, we may wish to record that Gautam works in the pharmacy
department as of January 1991.

• Relationship Sets
o A relationship set is a set of relationships of the same type.

Page 7
CS 4002 Unit 2- Data Modeling using ER Model (Part a)

3) COMPLEX ATTRIBUTES
• Domain/Value Set
o For each attribute, there is a set of permitted values, called the domain, or value
set, of that attribute.
o The domain of attribute course id might be the set of all text strings of a certain
length.
• Simple Attributes
o Attributes that can’t be divided into subparts.
o They are atomic in nature.
• Composite Attributes
o Composite can be divided into subparts (i.e., other attributes).
o For example, an attribute name could be structured as a composite attribute
consisting of first name, middle initial, and last name.
na
t na a t na

na
o Using composite attributes in a design schema is a good choice if a user will wish
to refer to an entire attribute on some occasions, and to only a component of the
attribute on other occasions.
o Suppose we were to add an address to the student entity-set.
o The address can be defined as the composite attribute address with the attributes
street, city, state, and postal code.
ct tat

t t ta c

o Composite attributes help us to group together related attributes, making the


modelling cleaner.

Page 8
CS 4002 Unit 2- Data Modeling using ER Model (Part a)

o Note also that a composite attribute may appear as a hierarchy. In the composite
attribute address, its component attribute street can be further divided into street
number, street name, and apartment number
a a t nt n

ct tat
t tn

ta c

t t na
a

• Single-valued Attributes
o The attributes in our examples all have a single value for a particular entity.
o For instance, the student_ID attribute for a specific student entity refers to only
one student_ID.
o Such attributes are said to be single valued.
• Multi-valued Attributes
o There may be instances where an attribute has a set of values for a specific entity.
o Suppose we add to the instructor entity set a phone_no attribute.
o An instructor may have zero, one, or several phone numbers, and different
o instructors may have different numbers of phones. This type of attribute is said to
be multivalued.
at nt

o As another example, we could add to the instructor entity set an attribute


dependent name listing all the dependents.
o This attribute would be multivalued, since any particular instructor may have
zero, one, or more dependents.

Page 9
CS 4002 Unit 2- Data Modeling using ER Model (Part a)

at nt
h n n

• Derived Attributes
o The value for this type of attribute can be derived from the values of other related
attributes or entities.
o Example :-
▪ The instructor entity set has an attribute age that indicates the
n t uct ’ ag
▪ If the instructor entity set also has an attribute date_of_birth, we
can calculate age from date of birth and the current date.
▪ Thus, age is a derived attribute.
▪ In this case, date of birth may be referred to as a base attribute, or a
stored attribute.
▪ The value of a derived attribute is not stored but is computed when
required.

at nt

ag

Page 10

You might also like