Chapter 3
Conceptual Databas Designe- E-R Modeling
• Database design is the process of coming up with different kinds of specification for the
data to be stored in the database. . The database design part is one of the middle phases we
have in information systems development where the system uses a database approach.
Information System with Database application consists of several tasks which include:
• Planning: identifying information gap in an organization and propose a database
solution to solve the problem
• Analysis: on fact finding about the problem or the opportunity
• Design (Conceptual, Logical and Physical Design)
• Implementation
• Testing and deployment
• Operation and Support
Con,t
From these different phases, the prime interest of a database system will be the Design
part which is again sub divided into other three sub-phases. These sub-phases are:
1. Conceptual Design
2. Logical Design, and
3. Physical Design
Conceptual Database Design
Conceptual design is the process of constructing a model of the information
used in an enterprise, independent of any physical considerations.
1. It is the source of information for the logical design phase.
2. Mostly uses an Entity Relationship Model to describe the data at this level.
After the completion of Conceptual Design one has to go for refinement of the
schema which is verification of Entities, Attributes, and Relationships
Conceptual design revolves around discovering and analyzing organizational
and user data requirements
The important activities are to identify: Entities; Attributes, Relationships
and Constraints
And based on these components develop the ER model using ER diagrams
Entity Relationship (E-R) Model
Entity-Relationship modeling is used to represent conceptual view of the database. The
main components of ER Modeling are
1. Entities
Corresponds to entire table, not row
Represented by Rectangle
2. Attributes
Represents the property used to describe an entity or a relationship
Represented by Oval
3. Relationships
Represents the association that exist between entities
Represented by Diamond
4. Constraints
Represent the constraint in the data
Cardinality and Participation Constraints.
Con,t
Before working on the conceptual design of the database, one has to know and
answer the following basic questions.
What are the entities and relationships in the enterprise?
What information about these entities and relationships should we store in
the database?
What are the integrity constraints that hold? Constraints on each data with
respect to update, retrieval and store.
Represent this information pictorially in ER diagrams, then map ER diagram
into a relational schema.
Developing an E-R Diagram
To identify the entities, attributes, relationships, and constraints on the data, there are different
set of methods used during the analysis phase. These include information gathered by…
Interviewing end users individually and in a group
Questionnaire survey
Direct observation
Examining different documents
Analysis of requirements gathered
Nouns -- prospective entities
Adjectives--prospective attributes
Verbs/verb phrases-prospective relationships
The basic E-R model is graphically depicted and presented for review.
The process is repeated until the end users and designers agree.
Checking for Redundant Relationships in the ER Diagram.
validating an ER Model against requirement of the user
Graphical representation of ER
Entity is represented by a RECTANGLE containing the name of the entity
Attributes are represented by OVALS and are connected to the entity
by a line.
Primary Keys are underlined and
A derived attribute is indicated by a DOTTED LINE.
Con.t
Relationships are represented by Diamond shaped symbols
*Weak Relationship is a relationship between Weak and Strong Entities
*Strong Relationship is a relationship between two strong Entities
Con,t
Example 1: Build an ER Diagram for the following information:
A student record management system will have the following two basic data object
categories with their own features or properties: Students will have an Id, Name, Dept, Age,
GPA and Course will have an Id, Name, Credit Hours. Whenever a student enroll in a
course in a specific Academic Year and Semester, the Student will have a grade for the
course
Structural Constraints on Relationship
Constraints on Relationship / Multiplicity/ Cardinality Constraints
Multiplicity constraint is the number or range of possible occurrence of an entity
type/relation that may relate to a single occurrence/tuple of an entity type/relation through a
particular relationship.
1. One-to-one relationship:
A customer is associated with at most one loan via the relationship borrower
A loan is associated with at most one customer via borrower
Relationship Manages between STAFF and BRANCH
The multiplicity of the relationship is:
One branch can only have one manager
One employee could manage either one or no branches
Con,t
2.One-To-Many Relationships
In the one-to-many relationship a loan is associated with at most one customer via
borrower, a customer is associated with several (including 0) loans via borrower
E.g.: Relationship Leads between STAFF and PROJECT
The multiplicity of the relationship
one staff may lead one or more project(s)
one project is lead by one staff
Con,t
3.Many-To-Many Relationship
A customer is associated with several (possibly 0) loans via borrower
A loan is associated with several (possibly 0) customers via borrower
E.G. Relationship ―Teaches‖ between INSTRUCTOR and COURSE
The multiplicity of the relationship:
One Instructor Teaches one or more Course(s)
One Course Thought by Zero or more Instructor(s)
Participation of an Entity Set in a
Relationship Set
feature of an entity occurrence to take a role in a relationship. There are two
distinct participation constraints, namely:
1. Total participation: every tuple in the entity or relation participates in at least
one relationship by taking a role. This means, every tuple in a relation will be
attached with at least one other tuple.
2. Partial participation: some tuple in the entity or relation may not participate in
the relationship. This means, there is at least one tuple from that Relation not
taking any role in that specific relationship .
Example 1:
Participation of EMPLOYEE in ―belongs to‖ relationship with DEPARTMENT is total
since every employee should belong to a department.
Participation of DEPARTMENT in ―belongs to‖ relationship with EMPLOYEE is total
since every department should have more than one employee
Con,t
Example 2:
Participation of employee in ―manages‖ relationship with Department, is partial
participation since not all employees are managers.
Participation of DEPARTMENT in ―Manages‖ relationship with EMPLOYEE is total
since every department should have a manager.
Problem in ER Modeling
The Entity-Relationship Model is a conceptual data model that views the real world as
consisting of entities and relationships. The model visually represents these concepts by the
Entity-Relationship diagram
While designing the ER model one could face a problem on the design which is called a
connection traps
Connection traps are problems arising from misinterpreting certain relationships.
There are two types of connection traps;
1. Fan trap:
Occurs where a model represents a relationship between entity types, but the pathway between certain entity
occurrences is ambiguous. May exist where two or more one-to-many (1:M) relationships fan out from an
entity.
Eample :
con,t
Semantic description:
Problem: Which car (Car1 or Car3 or Car5) is used by Employee 6 Emp6 working in
Branch 1 (Br1)? Thus from this ER Model one can not tell which car is used by which staff
since a branch can have more than one car and also a branch is populated by more than one
employee. Thus we need to restructure the model to avoid the connection trap. To avoid the
Fan Trap problem we can go for restructuring of the E-R Model. This will
Con,t
2.Chasm trap
Chasm Trap: Occurs where a model suggests the existence of a relationship between entity
types, but the path way does not exist between certain entity occurrences. Chasm trap may
exist when there are one or more relationships with a minimum multiplicity on cardinality
of zero forming part of the pathway between related entities.
Example:
Problem:
How can we identify which BRANCH is responsible for which PROJECT? We know that
whether the PROJECT is active or not there is a responsible BRANCH. But which branch is
a question to be answered, and since we have a minimum participation of zero between
employee and PROJECT we can‘t identify the BRANCH responsible for each PROJECT.
The solution for this Chasm Trap problem is to add another relationship between the
extreme entities (BRANCH and PROJECT)
Con,t
Enhanced E-R (EER) Models
EER is important when we have a relationship between two entities and the participation is
partial between entity occurrences. In such cases EER is used to reduce the complexity in
participation and relationship complexity.
EER diagrams allow refinements within the structures of entity types
EER Concepts
Generalization
Specialization
Sub classes
Super classes
1. Generalization
Generalization occurs when two or more entities represent categories of the same real world
object.
Generalization is the process of defining a more general entity type from a set of more
specialized entity types.
Is considered as bottom-up definition of entities.
2. Specialization
Is the result of subset of a higher level entity set to form a lower level entity
set.
The specialized entities will have additional set of attributes (distinguishing
characteristics) that distinguish them from the generalized entity.
Is considered as Top-Down definition of entities.
Reasons for Specialization
Attributes only partially applying to super classes
Relationship types only partially applicable to the superclass
Example: Saving Accounts and Current Accounts are Specialized entities for
the generalized entity Accounts. Manager, Sales, Secretary: are specialized
employees
3. Subclass/Subtype
An entity type whose tuples have attributes that distinguish its members
from tuples of the generalized or Superclass entities.
When one generalized Superclass has various subgroups with distinguishing
features and these subgroups are represented by specialized form, the
groups are called subclasses.
A single subclass may inherit attributes from two distinct superclasses.
E.g.: An EMPLOYEE can either be SALARIED or PART-TIMER but not
both.
A PERSONwho works for a university can be both EMPLOYEE and a
STUDENT at the same time.
4. Superclass /Supertype
An entity type whose tuples share common attributes. Attributes that
are shared by all entity occurrences (including the identifier) are
associated with the supertype
Is the generalized entity