0% found this document useful (0 votes)
12 views74 pages

Topic2 ERModel 5.6.2021

Uploaded by

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

Topic2 ERModel 5.6.2021

Uploaded by

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

Database Management System

Topic 2 – ER Model

Course Instructor

Santosh K. Vishwakarma
[email protected]
ICE GATE
Database Management System
S/W Design

➢ What is the systematic approach for software development ???

➢ SDLC
▪ Analysis (what)
▪ Design (how)
▪ Coding (implement)
▪ Testing (verify n validate)
▪ Deployment
▪ Maintenance

➢ UML model used for software design (Diagrammatic approach of s/w design)
Database Management System
DB Design

➢ What is the systematic approach for database project?


➢ requirement analysis
➢ conceptual database design ER Model

➢ logical database design


➢ schema refinement
➢ physical database design Beyond ER Model
➢ application and security design

➢ ER model used for database design (Diagrammatic approach of db design)


➢ ER model represent conceptual level of a database system
➢ Describe things and their relationships in high level
Database Management System
DB Design

➢ Requirement Analysis (Understanding the business rules)


➢ An employee can work for n departments
➢ An employee must work for a department
➢ An employee must work for only 1-department

➢ conceptual database design


➢ identifying entities attributes & relationships

➢ logical database design


➢ identify the tables & constraints on columns from er-diagram
Database Management System
DB Design

➢ Schema refinement
➢ check each table for insert delete & update anomalies
➢ decomposing the table

➢ physical database design


➢ creating indexes on TABLES for fast retrieval

➢ application & security design


➢ creating VIEWS on TABLES
➢ granting permission on VIEWS to USERS
Database Management System
Banking Example - 1
Database Management System
Banking Example - 2
Database Management System
Banking Example - 3
Database Management System
Components

➢ To make an E/R model you need to identify:


➢ Entities

➢ Attributes

➢ Relationships

➢ Mapping Cardinality

➢ Participation Constraints
Database Management System
Entity

Terminology Knowledge Similarity Examples Symbol


Entity anything which has Object (OO) Employee
some property Store
Noun (English) Product
makes sense to gather
Account
data around that
Course

Entity set – an abstraction of similar things, e.g. cars, students


An entity set contains many entities

Salary
ID DOJ

Employee
Database Management System
Strong Entity

➢ If the entity sets has its own primary key


➢ They can be uniquely identified
Database Management System
Weak Entity

➢ Some entity sets in real world naturally depend on some other entity set
➢ They can be uniquely identified only if combined with another entity set
➢ Double rectangles for weak entity set

➢ Example:
➢ section1, section2, … become unique only if you put them into a context, e.g. semester
➢ semester 1, semester 2 ….. become unique only if you put them into a context, e.g.
branch
Database Management System
Attribute

Terminology Knowledge Similarity Examples Symbol

Attribute Property of entity Column empid, ename,


is known as (Relational gender, salary
attribute Model)

Attributes: common properties of the entities in a entity sets


Database Management System
Types of Attributes

➢ Simple vs. Composite (branch ellipse)

➢ Single Valued vs. Multi Valued (double ellipse)

➢ Stored Vs Derived (dashed ellipse)

➢ Descriptive
Database Management System
Types of Attributes
Database Management System
Relationship

➢ Association between entities

➢ Relationship – specify the relations among entities from two or more entity sets

➢ Degree of relationship = number of participating attributes


Database Management System
Types of Relationship
Database Management System
Types of Relationship - Unary

• Sometimes entities in a entity set may relate to other entities in the same set. Thus self relationship
• Here employees mange some other employees
• The labels “manger” and “worker” are called roles the self relationship
Database Management System
Types of Relationship - Binary

• Two Entity Set participate in the relationship


Database Management System
Ternary Relationship
Database Management System
Relationship Constraints

➢ Mapping Cardinality
➢ Participation Constraints
Database Management System
Relationship Constraints

➢ Mapping Cardinality
Database Management System
Mapping Cardinality
Database Management System
Mapping Cardinality
Database Management System
Mapping Cardinality
Database Management System
Relationship Constraints

➢ Participation Constraints
➢ Total: when we require all entities to participate in the relationship
➢ double lines to specify
➢ Partial: Not all entities require to participate

Every loan must have at least one customer


Database Management System

Example 1

A university consists of a number of departments. Each department offers several courses. A


number of modules make up each course. Students enroll in a particular course and take
modules towards the completion of that course. Each module is taught by a lecturer from the
appropriate department, and each lecturer tutors a group of students
Database Management System

Example 1

A university consists of a number of departments. Each department offers several


courses. A number of modules make up each course. Students enrol in a particular
course and take modules towards the completion of that course. Each module is taught
by a lecturer from the appropriate department, and each lecturer tutors a group of
students
Database Management System

Example 1

A university consists of a number of departments. Each department offers several


courses. A number of modules make up each course. Students enrol in a particular
course and take modules towards the completion of that course. Each module is taught
by a lecturer from the appropriate department, and each lecturer tutors a group of
students
Database Management System

Example 1

A university consists of a number of departments. Each department offers several courses. A


number of modules make up each course. Students enrol in a particular course and take
modules towards the completion of that course. Each module is taught by a lecturer from the
appropriate department, and each lecturer tutors a group of students
Database Management System

What is the Primary Key of R


Database Management System

Where to place the Relationship Attribute


Database Management System

Reduction of ERD into tables

➢Strong Entity = all attributes of the entity

➢Weak Entity = all attributes of the entity + PK of strong entity

➢Composite Attribute = separate columns

➢Multivalued Attribute = separate tables

➢Relationship = depends on the mapping cardinality

➢Redundancy of the Tables


➢WES to SES
➢Participation Total
➢No descriptive Attribute

➢Combination of the Tables


➢SES to SES
➢Participation Total
➢No descriptive Attribute
Database Management System

Reduction of ERD into tables

➢Strong Entity = all attributes of the entity

➢Weak Entity = all attributes of the entity + PK of strong entity


Database Management System

Reduction of ERD into tables

➢Strong Entity = all attributes of the entity

➢Weak Entity = all attributes of the entity + PK of strong entity

➢Composite Attribute = separate columns


Database Management System

Reduction of ERD into tables

➢Strong Entity = all attributes of the entity

➢Weak Entity = all attributes of the entity + PK of strong entity

➢Composite Attribute = separate columns

➢Multivalued Attribute = separate tables


Database Management System

Reduction of ERD into tables

➢Strong Entity = all attributes of the entity

➢Weak Entity = all attributes of the entity + PK of strong entity

➢Composite Attribute = separate columns

➢Multivalued Attribute = separate tables

➢Relationship = depends on the mapping cardinality

➢Redundancy of the Tables


➢WES to SES
➢Participation Total
➢No descriptive Attribute

➢Combination of the Tables


➢SES to SES
➢Participation Total
➢No descriptive Attribute
Database Management System

Reduction of ERD into tables

➢Strong Entity = all attributes of the entity

➢Weak Entity = all attributes of the entity + PK of strong entity

➢Composite Attribute = separate columns

➢Multivalued Attribute = separate tables

➢Relationship = depends on the mapping cardinality

➢Redundancy of the Tables


➢WES to SES
➢Participation Total
➢No descriptive Attribute

➢Combination of the Tables


➢SES to SES
➢Participation Total
➢No descriptive Attribute
Reduction of ERD into tables
• Strong Entity = all attributes of the entity
Reduction of ERD into tables
• Strong Entity = all attributes of the entity
• Weak Entity = all attributes of the entity + PK of strong entity
Reduction of ERD into tables
• Strong Entity = all attributes of the entity
• Weak Entity = all attributes of the entity + PK of strong entity
• Composite Attribute = separate columns
Reduction of ERD into tables
• Strong Entity = all attributes of the entity
• Weak Entity = all attributes of the entity + PK of strong entity
• Composite Attribute = separate columns
• Multivalued Attribute = separate tables
Reduction of ERD into tables
• Relationship = depends on the mapping cardinality
Reduction of ERD into tables
• Relationship = depends on the mapping cardinality
• Redundancy of the Tables
WES to SES
Participation Total
No descriptive Attribute
Reduction of ERD into tables
• Combination of the Tables
SES to SES
Participation Total
No descriptive Attribute
Database Management System

Remarks

• Weak Entity always associate with Strong Entity


• Weak Entity participation is always total
• Identifying Relationship: when weak entity is connected to strong entity
Database Management System

Notations
Database Management System

Notations
Database Management System

Tools

Research Paper “Data Modeling in the Cloud” Author: Nenad Jukic et al.
ERD Plus – ER Diagram Example
Generate Relational Schema From ERD
Generate SQL From Relational Schema
Database Management System

GATE QUESTIONS
Database Management System
ER Model
Database Management System
ER Model
Database Management System
ER Model
Database Management System
ER Model
Database Management System
ER Model

Q5. E1 and E2 are two entities and R1, R2 are two relationship between E1 and E2 .
R1 is one to many and R2 is many to many. R1 and R2 dose not have any attribute their
own What is the minimum number of table needed. ? [GATE 2005]
Database Management System
ER Model

The minimum number of tables needed to represent M, N, P, R1, R2 is


(a) 2 (b) 3 (c) 4 (d) 5
Database Management System
Questions
Database Management System
Questions
Database Management System
Questions
Database Management System

Extended ER-Model

• Specialization
• Generalization
• Attribute Inheritance
• Aggregation
Database Management System

Extended ER-Model

• Specialization
• Generalization
• Attribute Inheritance
• Aggregation
Database Management System

Extended ER-Model

• Specialization
• A lower-level entity set inherits all the attributes and relationship participation of
the higher-level entity set to which it is linked.
• A lower-level entity set may have additional attributes and participate in
additional relationships
Database Management System

Extended ER-Model
Database Management System
EERD Example
Database Management System
Translating ER Diagrams into Class Hierarchies
Database Management System
Aggregation
Database Management System
ER Model

You might also like