SlideShare a Scribd company logo
Fundamentals of Database
system
Chapter Three:
Data Modelling using
Entity Relationship Model
Prepared by:
Misganaw Abeje
University of Gondar
College Of Informatics
Department of computer science
Misganaw.Abeje13@gmail.com
Outline
 Data Model Basic Building Blocks
 Using High level Data Models for Database Design
 Entity types and Sets, Attributes and Keys
 Relationships, Roles and Structural Constraints
 Weak Entity Types
 Enhanced ER Diagram
 E/R mapping to Relational
BY: MA
Data Model Basic Building Blocks
 To design a database first we have to understand the
basic Building block of relational Data model.
 Entity: anything about which data are to be collected and
stored
 Attribute: a characteristic of an entity
 Relationship: describes an association
among entities
– One-to-many (1:M) relationship
– Many-to-many (M:N or M:M) relationship
– One-to-one (1:1) relationship
• Constraint: a restriction placed on the data
BY: MA
Business Rules
 Descriptions of policies, procedures, or principles within
a specific organization
– Apply to any organization that stores and uses data to
generate information
 Description of operations to create/enforce actions
within an organization’s environment.
 Must be in writing and kept up to date.
 Must be easy to understand and widely disseminated.
 Describe characteristics of data as viewed by the
company.
BY: MA
Discovering Business Rules
 Sources of business rules:
– Company managers
– Policy makers
– Department managers
– Written documentation
 Procedures
 Standards
 Operations manuals
– Direct interviews with end users
BY: MA
Cont…
 Standardize company’s view of data
 Communications tool between users and designers
 Allow designer to understand the nature, role, and
scope of data.
 Allow designer to understand business processes
 Allow designer to develop appropriate relationship
participation rules and constraints .
BY: MA
Translating Business Rules into
Data Model Components
Generally:
 nouns translate into entities
 Verbs translate into relationships among entities.
 possessive phrases or description of refers to
attribute of entities.
 Relationships are bidirectional.
 Two questions to identify the relationship type:
– How many instances of B are related to one
instance of A?
– How many instances of A are related to one
instance of B?
BY: MA
Using High level Data Models for Database Design
 High-level conceptual data models provide concepts
for presenting data in ways that are close to the way
people perceive data.
 A typical example is the entity relationship model, which
uses main concepts like entities, attributes and
relationships.
 The two common conceptual models for Relational
Database system are
– Entity – Relationship (E/R) model
– Object-Oriented Data Language (ODL) model
BY: MA
Entity – Relationship (E/R) Data Model
 The E/R data model views the real world as a
set of
– Basic objects (Entities), and
– Relationships among these objects.
 The three basic notions of the E/R model are:
– Entity
– Relationship
– Attribute
BY: MA
Cont…
 Entities are usually recognizable concepts, either
concrete or abstract, such as:
– person, places, things, or events which have
relevance to the database.
 An Entity Set is then a set consisting of the same
type of entities that share same properties.
 In the requirement analysis the entities are
recognized by nouns and noun phrases.
BY: MA
Cont…
 Entities can be classified as:
– Strong (independent) entity
 One that does not rely on other entities for identification.
– Weak (dependent) entity
 one that relies on other entities for identification.
 Instance
– Instance also known as Object is an individual
occurrence of an entity set.
BY: MA
Attributes
 Attributes are descriptive properties that are
associated with an entity.
 Value
– Value is a particular instance of an attribute.
 Domain
– The domain of an attribute is the collection of all
possible values an attribute can have.
BY: MA
Classification of Attributes
 Identifiers
– more commonly called keys, uniquely identify an
instance of an entity.
 Descriptor
– describes a non-unique characteristic of an entity
instance.
 Example
– furniture Id
– catalog number, model type, color, …
13
BY: MA
… Classification of Attributes
 Simple Attributes
– also known as Atomic Attributes that can not be divided
into subparts mainly of primitive types.
 Composite Attributes
– are composed of smaller subparts that can be further
subdivided into the subparts (Attributes).
 Example
– Id, type, price, color
– name, address
14
BY: MA
… Classification of Attributes
 Single-valued Attributes
– are attributes having only one possible value at any
time.
 Multi-valued Attributes
– are attributes that are having possibly more than one
value.
 Example
– Id, name, type, price
– Address, degree
15
BY: MA
… Classification of Attributes
 Derived Attributes
– are attributes that can be calculated from the related
stored attributes, entities or general states.
 Stored Attributes
– are attributes that can not be calculated in any way
from the stored attributes.
 Example
– Age
– Birth Date
16
BY: MA
Relationship Sets
 A Relationship represents an association between
two or more entities.
 Example
– FURNITURE is produced by an EMPLOYEE from
RESOURCE
 FURNITURE is produced by EMPLOYEE
 FURNITURE is produced from RESOURCE
 SALE of FURNITURE is made with RECEIPT
17
BY: MA
… Relationship Sets
 A Relationship Set is then a set consisting same types of relationships. A
relationship should be named by a Verb or phrase which explains its
function (role name)
 Classification terms in Relationships
1. Degree
– number of entities associated with the relationship
 Binary – links two entity sets; set of ordered pairs (most common)
E.g. STUDENT and DORMITORY || STUDENT and COURSE
– Ternary – links three entity sets; ordered triples (rare). If a
relationship exists among the three entities, all three must be present.
E.g. INSTRUCTOR ,STUDENTS and a particular COURSE
 N-ary – links n entity sets; ordered n-tuples (extremely rare). If a
relationship exists among the entities, then all must be present. E.g.
INSTRUCTOR ,STUDENTS, rooms and a particular COURSE
18
BY: MA
… Relationship Sets
 Cardinality
– the actual number of related occurrences for each of the two entities
– is the number of entity instances to which another entity set can
map under the relationship.
 One-to-one: X-Y is 1:1 when each entity in X is associated
with at most one entity in Y, and each entity in Y is
associated with at most one entity in X. eg dept-headdept
 One-to-many: X-Y is 1:M when each entity in X can be
associated with many entities in Y, but each entity in Y is
associated with at most one entity in X. eg deptemployee
 Many-to-many: X:Y is M:M if each entity in X can be
associated with many entities in Y, and each entity in Y is
associated with many entities in X ("many" =>one or more
and sometimes zero)
BY: MA
Cont…
 Existence
– denotes whether the existence of an entity instance is
dependent upon the existence of another, related, entity
instance
 Mandatory: every instance of one entity must participate in a
relationship with another entity.
 Optional: any instance of one entity might participate in a
relationship with another entity, but this is not compulsory.
BY: MA
… Relationship Sets
– Cardinality
21
BY: MA
E/R Diagram
 Rectangles - for the Entity sets,
– Double border Rectangles - for the weak entity sets.
 Ellipses - for the Attributes,
– Double border Ellipses - for the multi-valued attributes.
– Dashed border Ellipses - for the derived attributes.
– Composite attributes are represented by linked ellipses.
 Diamonds - for the Relationships, and
 Lines - for the links between the attributes and the entity sets
and between the entity sets and the relationships.
– Arrow Head Line - for the link between an entity set with many-to-
one relationship.
 The arrow is headed to the one side entity set.
22
BY: MA
BY: MA
Example on Requirement Analysis
 The problem is to design a database system for “X
Household and Office Furniture P.L.C” based on the
following information.
– The information are kept on daily basis about what the
employees do, what resource they use, which furniture are
made out of the resource, and all the sale and order records.
– Furniture is produced by an employee from resource (s).
– Every furniture is described by the furniture Id, catalog no,
model type, color, production start date, production complete
date and price; and every resource is described by stock no,
type, current cost, and avail quantity.
– A sale of furniture is made with a receipt for both regular
customers and buyers.
24
BY: MA
… Example on Requirement
Analysis
 Regular customers are described by customer Id, name,
address and contact person; where as, no detail record is
established for buyers.
 Orders for furniture are allowed only for regular customers and
in ordering a furniture, the customer may pay part of the total
price and left in debt, then pay the debt in some other time.
 For the payment transactions three types of receipt are used;
one for sale, one for order and one for due payment (debt).
 A single receipt of each type is prepared only for one buyer or
customer but a number of furniture can be sold or ordered by
one receipt.
 Every receipt is prepared by Sales and it has receipt number,
prepared date, total price, and tax.
25
BY: MA
 Draw ER diagram for the previous requirement
analysis?
1. Identify the entities
2. Obtain the attributes of the entity
3. Identify the relation ship between the entities
• Entity : • Relationship • Attributes
• Furniture
• Resources
• employees
• Sales
• customers
• receipt
• Order
• Produced
• sold
• Furniture :fid,---
• employees :eid--
• Sales :id
• customers
• receipt
BY: MA
… Example
BY: MA
Exercise1
 Requirements of the university (oversimplified for
illustrative purposes)
– In a University database we might have entities for
Students, Modules and Lecturers.
– Students might have attributes such as their ID, Name, and
Course whereas Lecturers might have attributes such as
LID, Name, Rank and Modules might have attributes such
as ModuleNumber, ModuleName, CrHr and could have
relationships (studies) with Student and Modules and
(tutor) with Lecturers and Modules.
 Identify entity, Attributes and relationship?
 Draw the ER Diagram from the above requirement analysis?
BY: MA
Exercsise2: Country Bus Company
 A Country bus Company owns a number of buses. Each bus is
allocated to a particular route, although some routes may have
several buses. Each route passes through a number of towns. One
or more drivers are allocated to each stage of a route, which
corresponds to a journey through some or all of the towns on a route.
Some of the towns have a garage where buses are kept and each of
the buses are identified by the registration number and can carry
different numbers of passengers, since the vehicles vary in size and
can be single or double-decked. Each route is identified by a route
number and information is available on the average number of
passengers carried per day for each route. Drivers have an
employee number, name, address, and sometimes a telephone
number.
Further on E/R Diagram
 Relationship Attributes
– Attribute (s) may be used in some relationships to describe the
relationship further
 Multi-way Relationship
– multi-way relationship can be reduced to a binary relationship with
the use of
 an entity set in place of the relationship, and
 having new relationships for the links in between the participating
entity sets and the relationship.
 Cardinality Limits of a Relationship:
– 0..* or 0..∞
– 1..* or 1..∞
– 0..1
30
BY: MA
. . . Further on E/R Diagram
 Entity Set Roles in a Relationship
– Label on the link line identifies the role
– Example:
 If only two customers are allowed to make an order jointly as
Primary and Secondary
 Participation in a Relationship
– Total
 every element of the entity set is at least related to one element
in the other entity set
– Example:
 The Furniture entity set in the Produced relationship.
– Partial
 There at least one element that is not related to any element in
the other set
31
BY: MA
Example:
BY: MA
Design Issues
 Faithfulness
– classes or entity sets and their attributes should reflect reality
 Avoiding Redundancy
– be careful to say everything only once
 Simplicity
– avoid introducing more elements into your design than are absolutely
necessary
 Picking the Right kind of Element
– Entity Set versus Attributes
– Entity versus Relationship Sets
– Binary versus n-ary Relationship Sets
33
BY: MA
Remarks on Designing
 Choose meaningful naming for the entities,
attributes and relationships.
 Use short links.
 Cluster diagram if it has too many entities and
relationships.
34
BY: MA
Keys
 Keys are attributes or set of attributes that can be used to
uniquely identify an entity within the entity set
 Super Key also known as Super Set is then a set of one or more
attributes that can identify an entity uniquely from the entity set.
– If K is a super set (super key) then a set consisting of K is
also a super set.
 Candidate Key is the minimal super set. a Group of columns,
that uniquely identifies a row in a table.
– If the Candidate Key is selected as a key for an entity set then it said to
Primary Key.
– A candidate key has the properties of Uniqueness or Irreducibility
35
BY: MA
Relational Constraints/Integrity Rules
and keys:
 Each row of a table is uniquely identified by a PRIMARY KEY
 A primary key in E/R model is represented by underlining the attribute or
set of attributes.
 A column or combination of columns that matches the primary key of
another table is called a FOREIGN KEY which is used to cross-reference
tables.
 ENTITY INTEGRITY RULE of the model states that no component of the
primary key may contain a NULL value.
 REFERENTIAL INTEGRITY RULE : for every foreign key value in a
table there must be a corresponding primary key value in another table in
the database.
 Domain constraints/ INTEGRITY
– are requirements on an attribute value to be in a specified range of values.
BY: MA
Enhanced E/R Modeling
 Week Entity Set
 Specialization and Generalization
 Aggregation
37
BY: MA
Week Entity Set
 weak entity is uniquely identified with the help of
other entity
 The strong entity which contributes its primary key is
called the identifying or owner/dominant entity set.
 Criteria for weak entity set
– A one-to-many relationship set that relates the weak entity
set with owner entity set known as identifying relationship
or supporting relationship must exist.
– Total participation in the identifying relationship is required.
38
BY: MA
… Week Entity Set
 An attribute or set attributes with in the weak
entity set referred to as discriminator is used
to distinguish weak entities.
 Key of a weak entity set:
– Zero or more of its own attribute;
discriminator
– Key attributes of the owner (identifying)
entity set.
39
BY: MA
… Week Entity Set
 Notations
– Weak Entity sets are represented by
 Double boarder Rectangles.
– The identifying many-to-one relationship is
represented by
 Double border Diamonds.
– If the entity set has a discriminator then it is
represented by
 Underlining the attribute(s)
40
BY: MA
… Example (Weak entity sets)
– Each employee may have a number of Dependents.
 For each dependent, we keep track of their name, sex, birth
date, and relationship to the employee.
41
Employee DEPENDANT
Depenedent on
Name Descr
Eid
Descr
Name
BY: MA
Specialization and Generalization
 Specialization: Specialization is the process of defining a set of
subclasses of an entity type; this entity type is called the superclass of
the specialization. The set of subclasses that forms a specialization is
defined on the basis of some distinguishing characteristic of the entities
in the superclass.
– top-down process in grouping of entities that are similar in some way and distinct in
some other ways in which distinctions are made explicitly
– For example, the set of subclasses {SECRETARY,ENGINEER, TECHNICIAN} is a
specialization of the superclass EMPLOYEE that distinguishes among employee
entities based on the job type of each employee entity.
– The specialization of the EMPLOYEE entity type may yield the set of
subclasses {SALARIED_EMPLOYEE, HOURLY_EMPLOYEE}; this
specialization distinguishes among employees based on the method of pay
– Attributes that apply only to entities of a particular subclass—such as
TypingSpeed of SECRETARY—eng-type of engineers. These are called
42
BY: MA
 Generalization: The reverse of the specialization process.
– Several classes with common features are generalized into a superclass; original
classes become its subclasses
– the generalization process can be viewed as being functionally the inverse of the
specialization process.
– bottom-up approach in which multiple entity sets are synthesized into
a higher level entity set based on their common features.
– Example: CAR, TRUCK generalized into VEHICLE Because they have
several common attributes, they can be generalized into the entity
type VEHICLE, ; both CAR, TRUCK become subclasses of the superclass
VEHICLE. We can view {CAR, TRUCK} as a specialization of VEHICLE
– Alternatively, we can view VEHICLE as a generalization of CAR and
TRUCK
– EMPLOYEE as a generalization of SECRETARY, TECHNICIAN, and
… Example (Specialization & Generalization)
44
EMPLOYEES
ISA
ULL-TIME
EMPLOYEE
S
PART-TIME
EMPLOYEE
S
BY: MA
Constraints on Specialization and Generalization
 Condition-defined vs. User-defined Lower-level Entity Sets
– Condition defined: In some specializations we can determine exactly the
entities that will become members of each subclass by placing a
condition on the value of some attribute of the superclass. For example,
if the EMPLOYEE entity type has an attribute Job_type, as shown in
Figure 8.4, we can specify the condition of membership in the
SECRETARY subclass by the condition (Job_type = ‘Secretary’)
 satisfying an explicit condition or predicate
– User-defined: the Membership in such a subclass is determined by the
database user when they apply the operation to add an entity to the
subclass.
 determined upon the entry of the entities
45
BY: MA
 Disjoint vs. Overlapping Specialization
– Disjoint: Specifies that the subclasses of the specialization must
be disjointed (an entity can be a member of at most one of the
subclasses of the specialization)
– Eg an EMPLOYEE can be HOURLY_EMPLOYEE or a
ALARIED_EMPLOYEE. Specified by ‘d’ in EER diagram
– Overlapping: If not disjointed, overlap; that is the same entity may
be a member of more than one subclass of the specialization
 allows for a higher-level entity to belong to more than one
entity
 Eg: employee can be manager also employee
 Specified by ‘O’ in EER diagram
Constraints on Specialization and
Generalization
 Total vs. Partial Specialization or Generalization:
– The second constraint on specialization is called the completeness (or
totalness) constraint, which may be total or partial.
– A total specialization constraint specifies that every entity in the
superclass must be a member of at least one subclass in the
specialization. Higher level entity must belong to one of the lower-level
entity, For example, if every EMPLOYEE must be either an
HOURLY_EMPLOYEE or a SALARIED_EMPLOYEE,
– a partial specialization, which allows an entity not to belong to any of
the subclasses. For example, if some
EMPLOYEE entities do not belong to any of the subclasses
{SECRETARY, ENGINEER, TECHNICIAN}
 Generalization usually is total because the superclass is derived from
47
BY: MA
Aggregation
 E/R modeling allows relationships only between
entity sets.
 It achieve the relationship between a
relationship and an entity set or a collection of
entity sets.
– Aggregation is an abstraction through which
collection of related entity sets and relationships are
treated as high-level entities.
– It allows indicating for a relationship set (identified
through a box) to participate in another relationship
set.
48
BY: MA
… Example (Aggregation)
49
EMPLOYEES
FURNITURE RESOURCE
Production
Manages
BY: MA
ER model to relational model Mapping
 ER model to relational Mapping Algorithm
7-Step Process:
1. Map Regular/strong Entity Types
2. Map Weak Entity Types
3. Map Binary 1:1 Relation Types
4. Map Binary 1:N Relationship Types.
5. Map Binary M:N Relationship Types.
6. Map Multivalued attributes.
7. Map N-ary Relationship Types.
BY: MA
ER Model
BY: MA
1. Map Regular/strong Entity Types
 For each regular (strong) entity type E in the ER schema,
create a relation R that includes all the simple attributes of E.
 Choose one of the key attributes of E as the primary key for R.
 If the chosen key of E is composite, the set of simple attributes
that form it will together form the primary key of R.
BY: MA
2. Map Weak Entity Types
 For each weak entity type W in the ER schema with owner
entity type E, create a relation R & include all simple
attributes (or simple components of composite attributes) of
W as attributes of R.
 Also, include as foreign key attributes of R the primary key
attribute(s) of the relation(s) that correspond to the owner
entity type(s).
 The primary key of R is the combination of the primary
key(s) of the owner(s) and the partial key of the weak entity
type W, if any.
BY: MA
Cont…
BY: MA
3. Map Binary 1:1 Relation Types
 For each binary 1:1 relationship type R in the ER schema,
identify the relations S and T that correspond to the entity
types participating in R.
 Choose one of the relations-say S-and include a foreign key
in S the primary key of T. It is better to choose an entity type
with total participation in R in the role of S.
BY: MA
Cont…
BY: MA
4. Map Binary 1:N Relationship Types.
 For each regular binary 1:N relationship type R, identify
the relation S that represent the participating entity type at
the N-side of the relationship type.
 Include as foreign key in S the primary key of the relation
T that represents the other entity type participating in R.
 Include any simple attributes of the 1:N relation type as
attributes of S.
BY: MA
Cont…
BY: MA
5. Map Binary M:N Relationship Types.
 For each regular binary M:N relationship type R, create a
new relation S to represent R.
 Include as foreign key attributes in S the primary keys of
the relations that represent the participating entity types;
their combination will form the primary key of S.
 Also include any simple attributes of the M:N relationship
type (or simple components of composite attributes) as
attributes of S.
BY: MA
Cont…
BY: MA
6. Map Multivalued attributes.
 For each multivalued attribute A, create a new relation R.
 This relation R will include an attribute corresponding to A,
plus the primary key attribute K-as a foreign key in R-of
the relation that represents the entity type of relationship
type that has A as an attribute.
 The primary key of R is the combination of A and K. If the
multivalued attribute is composite, we include its simple
components.
BY: MA
Cont..
BY: MA
 For each n-ary relationship type R, where n>2, create a
new relationship S to represent R.
 Include as foreign key attributes in S the primary keys of
the relations that represent the participating entity types.
 Also include any simple attributes of the n-ary
relationship type (or simple components of composite
attributes) as attributes of S.
BY: MA
BY: MA
 Reference: Database Management Systems
3rdEdition Ramakrishnan - Gehrke
BY: MA
 Thank you

More Related Content

What's hot

FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
Vraj Patel
 
Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database concepts
Temesgenthanks
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship ModelSlideshare
 
Mapping ER and EER Model
Mapping ER and EER ModelMapping ER and EER Model
Mapping ER and EER Model
Mary Brinda
 
Database Chapter 3
Database Chapter 3Database Chapter 3
Database Chapter 3
shahadat hossain
 
Normalization
NormalizationNormalization
Normalization
Wangu Thupa
 
Ch1- Introduction to dbms
Ch1- Introduction to dbmsCh1- Introduction to dbms
Ch1- Introduction to dbms
Shakila Mahjabin
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
Vignesh Saravanan
 
Dbms normalization
Dbms normalizationDbms normalization
Dbms normalization
Pratik Devmurari
 
Database Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity TypesDatabase Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity Typesaakanksha s
 
OODM-object oriented data model
OODM-object oriented data modelOODM-object oriented data model
OODM-object oriented data model
AnilPokhrel7
 
Normalization PRESENTATION
Normalization PRESENTATIONNormalization PRESENTATION
Normalization PRESENTATION
bit allahabad
 
Introduction of DBMS
Introduction of DBMSIntroduction of DBMS
Introduction of DBMS
YouQue ™
 
Codds rule
Codds ruleCodds rule
Codds rule
Alvina Verghis
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
Shakila Mahjabin
 
DBMS PPT
DBMS PPTDBMS PPT
DBMS PPT
Prabhu Goyal
 
EER modeling
EER modelingEER modeling
EER modeling
Dabbal Singh Mahara
 
Different data models
Different data modelsDifferent data models
Different data models
madhusha udayangani
 
Object Oriented Dbms
Object Oriented DbmsObject Oriented Dbms
Object Oriented Dbms
maryeem
 

What's hot (20)

FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database concepts
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
Mapping ER and EER Model
Mapping ER and EER ModelMapping ER and EER Model
Mapping ER and EER Model
 
Database Chapter 3
Database Chapter 3Database Chapter 3
Database Chapter 3
 
Normalization
NormalizationNormalization
Normalization
 
Ch1- Introduction to dbms
Ch1- Introduction to dbmsCh1- Introduction to dbms
Ch1- Introduction to dbms
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
Dbms normalization
Dbms normalizationDbms normalization
Dbms normalization
 
Database Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity TypesDatabase Modeling Using Entity.. Weak And Strong Entity Types
Database Modeling Using Entity.. Weak And Strong Entity Types
 
OODM-object oriented data model
OODM-object oriented data modelOODM-object oriented data model
OODM-object oriented data model
 
Normalization PRESENTATION
Normalization PRESENTATIONNormalization PRESENTATION
Normalization PRESENTATION
 
Introduction of DBMS
Introduction of DBMSIntroduction of DBMS
Introduction of DBMS
 
Entity relationship modelling
Entity relationship modellingEntity relationship modelling
Entity relationship modelling
 
Codds rule
Codds ruleCodds rule
Codds rule
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
DBMS PPT
DBMS PPTDBMS PPT
DBMS PPT
 
EER modeling
EER modelingEER modeling
EER modeling
 
Different data models
Different data modelsDifferent data models
Different data models
 
Object Oriented Dbms
Object Oriented DbmsObject Oriented Dbms
Object Oriented Dbms
 

Similar to chapter 3-Data Modelling using Entity Relationship .pdf

Database Management System
Database Management System Database Management System
Database Management System
FellowBuddy.com
 
Revision ch 3
Revision ch 3Revision ch 3
Revision ch 3
Rupali Rana
 
database.pptx
database.pptxdatabase.pptx
database.pptx
lumaeducation
 
Unit 2 DBMS
Unit 2 DBMSUnit 2 DBMS
Unit 2 DBMS
DhivyaSubramaniyam
 
The Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxThe Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptx
MANASINANDKISHORDEOR
 
ER MODEL.pptx
ER MODEL.pptxER MODEL.pptx
ER MODEL.pptx
TusharSingh711352
 
Use analyzed requirements in the design of database.pptx
Use analyzed requirements in the design of database.pptxUse analyzed requirements in the design of database.pptx
Use analyzed requirements in the design of database.pptx
MwangaPrayGod
 
39f1b9a797dbms chapter2 b.sc2
39f1b9a797dbms chapter2 b.sc239f1b9a797dbms chapter2 b.sc2
39f1b9a797dbms chapter2 b.sc2Mukund Trivedi
 
39f1b9a797dbms chapter2 b.sc2 (1)
39f1b9a797dbms chapter2 b.sc2 (1)39f1b9a797dbms chapter2 b.sc2 (1)
39f1b9a797dbms chapter2 b.sc2 (1)Mukund Trivedi
 
Basic concepts of Data and Databases
Basic concepts of Data and Databases Basic concepts of Data and Databases
Basic concepts of Data and Databases
Tharindu Weerasinghe
 
Week 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data ModelWeek 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data Model
oudesign
 
ER MODEL
ER MODELER MODEL
ER MODEL
Rupali Rana
 
DBMS - ER Model
DBMS - ER ModelDBMS - ER Model
DBMS - ER Model
MythiliMurugan3
 
Chapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptxChapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptx
santosh96234
 
Download different material from slide share
Download different material from slide shareDownload different material from slide share
Download different material from slide share
fanta teferi
 
dbms mannual.pdf
dbms mannual.pdfdbms mannual.pdf
dbms mannual.pdf
DevidasBhere
 
Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..
Nimrakhan89
 

Similar to chapter 3-Data Modelling using Entity Relationship .pdf (20)

Database Management System
Database Management System Database Management System
Database Management System
 
Dbms
DbmsDbms
Dbms
 
Revision ch 3
Revision ch 3Revision ch 3
Revision ch 3
 
database.pptx
database.pptxdatabase.pptx
database.pptx
 
Unit 2 DBMS
Unit 2 DBMSUnit 2 DBMS
Unit 2 DBMS
 
The Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxThe Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptx
 
ER MODEL.pptx
ER MODEL.pptxER MODEL.pptx
ER MODEL.pptx
 
Use analyzed requirements in the design of database.pptx
Use analyzed requirements in the design of database.pptxUse analyzed requirements in the design of database.pptx
Use analyzed requirements in the design of database.pptx
 
Ch 3 E R Model
Ch 3  E R  ModelCh 3  E R  Model
Ch 3 E R Model
 
39f1b9a797dbms chapter2 b.sc2
39f1b9a797dbms chapter2 b.sc239f1b9a797dbms chapter2 b.sc2
39f1b9a797dbms chapter2 b.sc2
 
39f1b9a797dbms chapter2 b.sc2 (1)
39f1b9a797dbms chapter2 b.sc2 (1)39f1b9a797dbms chapter2 b.sc2 (1)
39f1b9a797dbms chapter2 b.sc2 (1)
 
Basic concepts of Data and Databases
Basic concepts of Data and Databases Basic concepts of Data and Databases
Basic concepts of Data and Databases
 
Week 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data ModelWeek 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data Model
 
ER MODEL
ER MODELER MODEL
ER MODEL
 
DBMS - ER Model
DBMS - ER ModelDBMS - ER Model
DBMS - ER Model
 
Chapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptxChapter 2. Concepctual design -.pptx
Chapter 2. Concepctual design -.pptx
 
Download different material from slide share
Download different material from slide shareDownload different material from slide share
Download different material from slide share
 
RDBMS ERD
RDBMS ERDRDBMS ERD
RDBMS ERD
 
dbms mannual.pdf
dbms mannual.pdfdbms mannual.pdf
dbms mannual.pdf
 
Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..Advantages and disadvantages of er model in DBMS. Types of database models ..
Advantages and disadvantages of er model in DBMS. Types of database models ..
 

Recently uploaded

Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 

Recently uploaded (20)

Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 

chapter 3-Data Modelling using Entity Relationship .pdf

  • 1. Fundamentals of Database system Chapter Three: Data Modelling using Entity Relationship Model Prepared by: Misganaw Abeje University of Gondar College Of Informatics Department of computer science Misganaw.Abeje13@gmail.com
  • 2. Outline  Data Model Basic Building Blocks  Using High level Data Models for Database Design  Entity types and Sets, Attributes and Keys  Relationships, Roles and Structural Constraints  Weak Entity Types  Enhanced ER Diagram  E/R mapping to Relational BY: MA
  • 3. Data Model Basic Building Blocks  To design a database first we have to understand the basic Building block of relational Data model.  Entity: anything about which data are to be collected and stored  Attribute: a characteristic of an entity  Relationship: describes an association among entities – One-to-many (1:M) relationship – Many-to-many (M:N or M:M) relationship – One-to-one (1:1) relationship • Constraint: a restriction placed on the data BY: MA
  • 4. Business Rules  Descriptions of policies, procedures, or principles within a specific organization – Apply to any organization that stores and uses data to generate information  Description of operations to create/enforce actions within an organization’s environment.  Must be in writing and kept up to date.  Must be easy to understand and widely disseminated.  Describe characteristics of data as viewed by the company. BY: MA
  • 5. Discovering Business Rules  Sources of business rules: – Company managers – Policy makers – Department managers – Written documentation  Procedures  Standards  Operations manuals – Direct interviews with end users BY: MA
  • 6. Cont…  Standardize company’s view of data  Communications tool between users and designers  Allow designer to understand the nature, role, and scope of data.  Allow designer to understand business processes  Allow designer to develop appropriate relationship participation rules and constraints . BY: MA
  • 7. Translating Business Rules into Data Model Components Generally:  nouns translate into entities  Verbs translate into relationships among entities.  possessive phrases or description of refers to attribute of entities.  Relationships are bidirectional.  Two questions to identify the relationship type: – How many instances of B are related to one instance of A? – How many instances of A are related to one instance of B? BY: MA
  • 8. Using High level Data Models for Database Design  High-level conceptual data models provide concepts for presenting data in ways that are close to the way people perceive data.  A typical example is the entity relationship model, which uses main concepts like entities, attributes and relationships.  The two common conceptual models for Relational Database system are – Entity – Relationship (E/R) model – Object-Oriented Data Language (ODL) model BY: MA
  • 9. Entity – Relationship (E/R) Data Model  The E/R data model views the real world as a set of – Basic objects (Entities), and – Relationships among these objects.  The three basic notions of the E/R model are: – Entity – Relationship – Attribute BY: MA
  • 10. Cont…  Entities are usually recognizable concepts, either concrete or abstract, such as: – person, places, things, or events which have relevance to the database.  An Entity Set is then a set consisting of the same type of entities that share same properties.  In the requirement analysis the entities are recognized by nouns and noun phrases. BY: MA
  • 11. Cont…  Entities can be classified as: – Strong (independent) entity  One that does not rely on other entities for identification. – Weak (dependent) entity  one that relies on other entities for identification.  Instance – Instance also known as Object is an individual occurrence of an entity set. BY: MA
  • 12. Attributes  Attributes are descriptive properties that are associated with an entity.  Value – Value is a particular instance of an attribute.  Domain – The domain of an attribute is the collection of all possible values an attribute can have. BY: MA
  • 13. Classification of Attributes  Identifiers – more commonly called keys, uniquely identify an instance of an entity.  Descriptor – describes a non-unique characteristic of an entity instance.  Example – furniture Id – catalog number, model type, color, … 13 BY: MA
  • 14. … Classification of Attributes  Simple Attributes – also known as Atomic Attributes that can not be divided into subparts mainly of primitive types.  Composite Attributes – are composed of smaller subparts that can be further subdivided into the subparts (Attributes).  Example – Id, type, price, color – name, address 14 BY: MA
  • 15. … Classification of Attributes  Single-valued Attributes – are attributes having only one possible value at any time.  Multi-valued Attributes – are attributes that are having possibly more than one value.  Example – Id, name, type, price – Address, degree 15 BY: MA
  • 16. … Classification of Attributes  Derived Attributes – are attributes that can be calculated from the related stored attributes, entities or general states.  Stored Attributes – are attributes that can not be calculated in any way from the stored attributes.  Example – Age – Birth Date 16 BY: MA
  • 17. Relationship Sets  A Relationship represents an association between two or more entities.  Example – FURNITURE is produced by an EMPLOYEE from RESOURCE  FURNITURE is produced by EMPLOYEE  FURNITURE is produced from RESOURCE  SALE of FURNITURE is made with RECEIPT 17 BY: MA
  • 18. … Relationship Sets  A Relationship Set is then a set consisting same types of relationships. A relationship should be named by a Verb or phrase which explains its function (role name)  Classification terms in Relationships 1. Degree – number of entities associated with the relationship  Binary – links two entity sets; set of ordered pairs (most common) E.g. STUDENT and DORMITORY || STUDENT and COURSE – Ternary – links three entity sets; ordered triples (rare). If a relationship exists among the three entities, all three must be present. E.g. INSTRUCTOR ,STUDENTS and a particular COURSE  N-ary – links n entity sets; ordered n-tuples (extremely rare). If a relationship exists among the entities, then all must be present. E.g. INSTRUCTOR ,STUDENTS, rooms and a particular COURSE 18 BY: MA
  • 19. … Relationship Sets  Cardinality – the actual number of related occurrences for each of the two entities – is the number of entity instances to which another entity set can map under the relationship.  One-to-one: X-Y is 1:1 when each entity in X is associated with at most one entity in Y, and each entity in Y is associated with at most one entity in X. eg dept-headdept  One-to-many: X-Y is 1:M when each entity in X can be associated with many entities in Y, but each entity in Y is associated with at most one entity in X. eg deptemployee  Many-to-many: X:Y is M:M if each entity in X can be associated with many entities in Y, and each entity in Y is associated with many entities in X ("many" =>one or more and sometimes zero) BY: MA
  • 20. Cont…  Existence – denotes whether the existence of an entity instance is dependent upon the existence of another, related, entity instance  Mandatory: every instance of one entity must participate in a relationship with another entity.  Optional: any instance of one entity might participate in a relationship with another entity, but this is not compulsory. BY: MA
  • 21. … Relationship Sets – Cardinality 21 BY: MA
  • 22. E/R Diagram  Rectangles - for the Entity sets, – Double border Rectangles - for the weak entity sets.  Ellipses - for the Attributes, – Double border Ellipses - for the multi-valued attributes. – Dashed border Ellipses - for the derived attributes. – Composite attributes are represented by linked ellipses.  Diamonds - for the Relationships, and  Lines - for the links between the attributes and the entity sets and between the entity sets and the relationships. – Arrow Head Line - for the link between an entity set with many-to- one relationship.  The arrow is headed to the one side entity set. 22 BY: MA
  • 24. Example on Requirement Analysis  The problem is to design a database system for “X Household and Office Furniture P.L.C” based on the following information. – The information are kept on daily basis about what the employees do, what resource they use, which furniture are made out of the resource, and all the sale and order records. – Furniture is produced by an employee from resource (s). – Every furniture is described by the furniture Id, catalog no, model type, color, production start date, production complete date and price; and every resource is described by stock no, type, current cost, and avail quantity. – A sale of furniture is made with a receipt for both regular customers and buyers. 24 BY: MA
  • 25. … Example on Requirement Analysis  Regular customers are described by customer Id, name, address and contact person; where as, no detail record is established for buyers.  Orders for furniture are allowed only for regular customers and in ordering a furniture, the customer may pay part of the total price and left in debt, then pay the debt in some other time.  For the payment transactions three types of receipt are used; one for sale, one for order and one for due payment (debt).  A single receipt of each type is prepared only for one buyer or customer but a number of furniture can be sold or ordered by one receipt.  Every receipt is prepared by Sales and it has receipt number, prepared date, total price, and tax. 25 BY: MA
  • 26.  Draw ER diagram for the previous requirement analysis? 1. Identify the entities 2. Obtain the attributes of the entity 3. Identify the relation ship between the entities • Entity : • Relationship • Attributes • Furniture • Resources • employees • Sales • customers • receipt • Order • Produced • sold • Furniture :fid,--- • employees :eid-- • Sales :id • customers • receipt BY: MA
  • 28. Exercise1  Requirements of the university (oversimplified for illustrative purposes) – In a University database we might have entities for Students, Modules and Lecturers. – Students might have attributes such as their ID, Name, and Course whereas Lecturers might have attributes such as LID, Name, Rank and Modules might have attributes such as ModuleNumber, ModuleName, CrHr and could have relationships (studies) with Student and Modules and (tutor) with Lecturers and Modules.  Identify entity, Attributes and relationship?  Draw the ER Diagram from the above requirement analysis? BY: MA
  • 29. Exercsise2: Country Bus Company  A Country bus Company owns a number of buses. Each bus is allocated to a particular route, although some routes may have several buses. Each route passes through a number of towns. One or more drivers are allocated to each stage of a route, which corresponds to a journey through some or all of the towns on a route. Some of the towns have a garage where buses are kept and each of the buses are identified by the registration number and can carry different numbers of passengers, since the vehicles vary in size and can be single or double-decked. Each route is identified by a route number and information is available on the average number of passengers carried per day for each route. Drivers have an employee number, name, address, and sometimes a telephone number.
  • 30. Further on E/R Diagram  Relationship Attributes – Attribute (s) may be used in some relationships to describe the relationship further  Multi-way Relationship – multi-way relationship can be reduced to a binary relationship with the use of  an entity set in place of the relationship, and  having new relationships for the links in between the participating entity sets and the relationship.  Cardinality Limits of a Relationship: – 0..* or 0..∞ – 1..* or 1..∞ – 0..1 30 BY: MA
  • 31. . . . Further on E/R Diagram  Entity Set Roles in a Relationship – Label on the link line identifies the role – Example:  If only two customers are allowed to make an order jointly as Primary and Secondary  Participation in a Relationship – Total  every element of the entity set is at least related to one element in the other entity set – Example:  The Furniture entity set in the Produced relationship. – Partial  There at least one element that is not related to any element in the other set 31 BY: MA
  • 33. Design Issues  Faithfulness – classes or entity sets and their attributes should reflect reality  Avoiding Redundancy – be careful to say everything only once  Simplicity – avoid introducing more elements into your design than are absolutely necessary  Picking the Right kind of Element – Entity Set versus Attributes – Entity versus Relationship Sets – Binary versus n-ary Relationship Sets 33 BY: MA
  • 34. Remarks on Designing  Choose meaningful naming for the entities, attributes and relationships.  Use short links.  Cluster diagram if it has too many entities and relationships. 34 BY: MA
  • 35. Keys  Keys are attributes or set of attributes that can be used to uniquely identify an entity within the entity set  Super Key also known as Super Set is then a set of one or more attributes that can identify an entity uniquely from the entity set. – If K is a super set (super key) then a set consisting of K is also a super set.  Candidate Key is the minimal super set. a Group of columns, that uniquely identifies a row in a table. – If the Candidate Key is selected as a key for an entity set then it said to Primary Key. – A candidate key has the properties of Uniqueness or Irreducibility 35 BY: MA
  • 36. Relational Constraints/Integrity Rules and keys:  Each row of a table is uniquely identified by a PRIMARY KEY  A primary key in E/R model is represented by underlining the attribute or set of attributes.  A column or combination of columns that matches the primary key of another table is called a FOREIGN KEY which is used to cross-reference tables.  ENTITY INTEGRITY RULE of the model states that no component of the primary key may contain a NULL value.  REFERENTIAL INTEGRITY RULE : for every foreign key value in a table there must be a corresponding primary key value in another table in the database.  Domain constraints/ INTEGRITY – are requirements on an attribute value to be in a specified range of values. BY: MA
  • 37. Enhanced E/R Modeling  Week Entity Set  Specialization and Generalization  Aggregation 37 BY: MA
  • 38. Week Entity Set  weak entity is uniquely identified with the help of other entity  The strong entity which contributes its primary key is called the identifying or owner/dominant entity set.  Criteria for weak entity set – A one-to-many relationship set that relates the weak entity set with owner entity set known as identifying relationship or supporting relationship must exist. – Total participation in the identifying relationship is required. 38 BY: MA
  • 39. … Week Entity Set  An attribute or set attributes with in the weak entity set referred to as discriminator is used to distinguish weak entities.  Key of a weak entity set: – Zero or more of its own attribute; discriminator – Key attributes of the owner (identifying) entity set. 39 BY: MA
  • 40. … Week Entity Set  Notations – Weak Entity sets are represented by  Double boarder Rectangles. – The identifying many-to-one relationship is represented by  Double border Diamonds. – If the entity set has a discriminator then it is represented by  Underlining the attribute(s) 40 BY: MA
  • 41. … Example (Weak entity sets) – Each employee may have a number of Dependents.  For each dependent, we keep track of their name, sex, birth date, and relationship to the employee. 41 Employee DEPENDANT Depenedent on Name Descr Eid Descr Name BY: MA
  • 42. Specialization and Generalization  Specialization: Specialization is the process of defining a set of subclasses of an entity type; this entity type is called the superclass of the specialization. The set of subclasses that forms a specialization is defined on the basis of some distinguishing characteristic of the entities in the superclass. – top-down process in grouping of entities that are similar in some way and distinct in some other ways in which distinctions are made explicitly – For example, the set of subclasses {SECRETARY,ENGINEER, TECHNICIAN} is a specialization of the superclass EMPLOYEE that distinguishes among employee entities based on the job type of each employee entity. – The specialization of the EMPLOYEE entity type may yield the set of subclasses {SALARIED_EMPLOYEE, HOURLY_EMPLOYEE}; this specialization distinguishes among employees based on the method of pay – Attributes that apply only to entities of a particular subclass—such as TypingSpeed of SECRETARY—eng-type of engineers. These are called 42 BY: MA
  • 43.  Generalization: The reverse of the specialization process. – Several classes with common features are generalized into a superclass; original classes become its subclasses – the generalization process can be viewed as being functionally the inverse of the specialization process. – bottom-up approach in which multiple entity sets are synthesized into a higher level entity set based on their common features. – Example: CAR, TRUCK generalized into VEHICLE Because they have several common attributes, they can be generalized into the entity type VEHICLE, ; both CAR, TRUCK become subclasses of the superclass VEHICLE. We can view {CAR, TRUCK} as a specialization of VEHICLE – Alternatively, we can view VEHICLE as a generalization of CAR and TRUCK – EMPLOYEE as a generalization of SECRETARY, TECHNICIAN, and
  • 44. … Example (Specialization & Generalization) 44 EMPLOYEES ISA ULL-TIME EMPLOYEE S PART-TIME EMPLOYEE S BY: MA
  • 45. Constraints on Specialization and Generalization  Condition-defined vs. User-defined Lower-level Entity Sets – Condition defined: In some specializations we can determine exactly the entities that will become members of each subclass by placing a condition on the value of some attribute of the superclass. For example, if the EMPLOYEE entity type has an attribute Job_type, as shown in Figure 8.4, we can specify the condition of membership in the SECRETARY subclass by the condition (Job_type = ‘Secretary’)  satisfying an explicit condition or predicate – User-defined: the Membership in such a subclass is determined by the database user when they apply the operation to add an entity to the subclass.  determined upon the entry of the entities 45 BY: MA
  • 46.  Disjoint vs. Overlapping Specialization – Disjoint: Specifies that the subclasses of the specialization must be disjointed (an entity can be a member of at most one of the subclasses of the specialization) – Eg an EMPLOYEE can be HOURLY_EMPLOYEE or a ALARIED_EMPLOYEE. Specified by ‘d’ in EER diagram – Overlapping: If not disjointed, overlap; that is the same entity may be a member of more than one subclass of the specialization  allows for a higher-level entity to belong to more than one entity  Eg: employee can be manager also employee  Specified by ‘O’ in EER diagram
  • 47. Constraints on Specialization and Generalization  Total vs. Partial Specialization or Generalization: – The second constraint on specialization is called the completeness (or totalness) constraint, which may be total or partial. – A total specialization constraint specifies that every entity in the superclass must be a member of at least one subclass in the specialization. Higher level entity must belong to one of the lower-level entity, For example, if every EMPLOYEE must be either an HOURLY_EMPLOYEE or a SALARIED_EMPLOYEE, – a partial specialization, which allows an entity not to belong to any of the subclasses. For example, if some EMPLOYEE entities do not belong to any of the subclasses {SECRETARY, ENGINEER, TECHNICIAN}  Generalization usually is total because the superclass is derived from 47 BY: MA
  • 48. Aggregation  E/R modeling allows relationships only between entity sets.  It achieve the relationship between a relationship and an entity set or a collection of entity sets. – Aggregation is an abstraction through which collection of related entity sets and relationships are treated as high-level entities. – It allows indicating for a relationship set (identified through a box) to participate in another relationship set. 48 BY: MA
  • 49. … Example (Aggregation) 49 EMPLOYEES FURNITURE RESOURCE Production Manages BY: MA
  • 50. ER model to relational model Mapping  ER model to relational Mapping Algorithm 7-Step Process: 1. Map Regular/strong Entity Types 2. Map Weak Entity Types 3. Map Binary 1:1 Relation Types 4. Map Binary 1:N Relationship Types. 5. Map Binary M:N Relationship Types. 6. Map Multivalued attributes. 7. Map N-ary Relationship Types. BY: MA
  • 52. 1. Map Regular/strong Entity Types  For each regular (strong) entity type E in the ER schema, create a relation R that includes all the simple attributes of E.  Choose one of the key attributes of E as the primary key for R.  If the chosen key of E is composite, the set of simple attributes that form it will together form the primary key of R. BY: MA
  • 53. 2. Map Weak Entity Types  For each weak entity type W in the ER schema with owner entity type E, create a relation R & include all simple attributes (or simple components of composite attributes) of W as attributes of R.  Also, include as foreign key attributes of R the primary key attribute(s) of the relation(s) that correspond to the owner entity type(s).  The primary key of R is the combination of the primary key(s) of the owner(s) and the partial key of the weak entity type W, if any. BY: MA
  • 55. 3. Map Binary 1:1 Relation Types  For each binary 1:1 relationship type R in the ER schema, identify the relations S and T that correspond to the entity types participating in R.  Choose one of the relations-say S-and include a foreign key in S the primary key of T. It is better to choose an entity type with total participation in R in the role of S. BY: MA
  • 57. 4. Map Binary 1:N Relationship Types.  For each regular binary 1:N relationship type R, identify the relation S that represent the participating entity type at the N-side of the relationship type.  Include as foreign key in S the primary key of the relation T that represents the other entity type participating in R.  Include any simple attributes of the 1:N relation type as attributes of S. BY: MA
  • 59. 5. Map Binary M:N Relationship Types.  For each regular binary M:N relationship type R, create a new relation S to represent R.  Include as foreign key attributes in S the primary keys of the relations that represent the participating entity types; their combination will form the primary key of S.  Also include any simple attributes of the M:N relationship type (or simple components of composite attributes) as attributes of S. BY: MA
  • 61. 6. Map Multivalued attributes.  For each multivalued attribute A, create a new relation R.  This relation R will include an attribute corresponding to A, plus the primary key attribute K-as a foreign key in R-of the relation that represents the entity type of relationship type that has A as an attribute.  The primary key of R is the combination of A and K. If the multivalued attribute is composite, we include its simple components. BY: MA
  • 63.  For each n-ary relationship type R, where n>2, create a new relationship S to represent R.  Include as foreign key attributes in S the primary keys of the relations that represent the participating entity types.  Also include any simple attributes of the n-ary relationship type (or simple components of composite attributes) as attributes of S. BY: MA
  • 65.  Reference: Database Management Systems 3rdEdition Ramakrishnan - Gehrke BY: MA