Presentations PPT Unit-3 25042019031301AM

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 58

Unit – 3

Entity-
Relationship
Model
Prof. Firoz Sherasiya
 9879879861
[email protected]
Database
Database Management
Management System
System (2130703)
(2130703) Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Topics to be covered
• Basic concepts
• Design process
• Constraints and keys
• Design issues
• E-R diagrams
• Weak entity sets
• Extended E-R features
• Generalization and Specialization
• Aggregation
• Reduction to E-R database schema
Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 22 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
What is Database Design?
 Database Design is a collection of processes that facilitate the
designing, development, implementation and maintenance of
enterprise database management systems.

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 33 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
What is E-R diagram?
 E-R diagram: (Entity-Relationship diagram)
 It is graphical (pictorial) representation of database.
 It uses different types of symbols to represent different objects of
database.

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 44 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Entity
 An entity is a person, a place or an object.
 An entity is represented by a rectangle which contains the name
of an entity.
 Entities of a college database are:
• Student
• Professor/Faculty Entity Name

• Course
Symbol
• Department
• Result
• Class
Student
• Subject

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 55 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Exercise
Exercise

1. Write down the different entities of bank database.


2. Write down the different entities of hospital database.

Unit
Unit –– 2:
2: Relational
Relational Model
Model 66 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Entity Set
 It is a set (group) of entities of same type.
 Examples:
• All persons having an account in a bank
• All the students studying in a college
• All the professors working in a college
• Set of all accounts in a bank

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 77 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Attributes
 Attribute is properties or details about an entity.
 An attribute is represented by an oval containing name of an
attribute.
 Attributes of Student are:
• Roll No
Attribute
• Student Name Name
• Branch
Symbol
• Semester
• Address
RollNo Name
• Mobile No
• Age
• SPI
Student
• Backlogs

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 88 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Exercise
Exercise

1. Write down the attributes of Faculty.


2. Write down the attributes of Account.

Unit
Unit –– 2:
2: Relational
Relational Model
Model 99 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Relationship
 Relationship is an association (connection) between several
entities.
 It should be placed between two entities and a line connecting it
to an entity.
 A relationship is represented by a diamond containing
relationship's name.

Relationship
Name

Symbol

Student Issue Book

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 10
10 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
E-R Diagram of a Library System
Primary Key Primary Key
Attributes
RollNo Name BookNo Name
Relationship

Student Issue Book

Branch Sem Entities Author Price

 Each and every entity must have one primary key attribute.
 Relationship between 2 entities is called binary relationship.

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 11
11 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Ternary Relationship
ProjectID Project Name

Project

FacID Name RollNo Name

Faculty Guide Student

Branch Technology Branch Sem

Relationship between 3 entities is called ternary relationship.


Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 12
12 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Exercise
Exercise

1. Draw E-R diagram of following pair of entities


i. Customer & Account
ii. Customer & Loan
iii. Doctor & Patient

Unit
Unit –– 2:
2: Relational
Relational Model
Model 13
13 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Types of Attribute
Simple Attribute Composite Attribute
Cannot be divided into subparts Can be divided into subparts
E.g. RollNo, CPI E.g. Name
(first name, middle name, last name)

Address
(street, road, city)

Symbol Symbol
Roll No Name

First name Last name

Middle name

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 14
14 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Types of Attribute
Single-valued Attribute Multi-valued Attribute
Has single value Have multiple value
E.g. Rollno, CPI E.g. Phoneno
(person may have multiple phone nos)

EmailID
(person may have multiple emails)

Symbol Symbol
Roll No Phone No

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 15
15 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Types of Attribute
Stored Attribute Derived Attribute
It’s value is stored manually in database It’s value is derived or calculated from
other attributes.
E.g. Birthdate E.g. Age
(can be calculated using current date
and birthdate)

Symbol Symbol
Birthdate Age

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 16
16 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Entity with all types of Attributes
Middle
Name
First Name Last Name
Single
Simple
Value
RollNo Name Composite Apartment
Derived Composite

Age Student Address Street

Multiple Stored
Value
Phone No Birth Date Area

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 17
17 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Exercise
Exercise

1. Draw an ER diagram of Banking Management System.


2. Draw an ER diagram of Hospital Management System.
i. Take only 2 entities
ii. Use all types of attributes
iii. Use proper relationship

Unit
Unit –– 2:
2: Relational
Relational Model
Model 18
18 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Descriptive Attribute
 Attributes of the relationship is called descriptive attribute.
Descriptive
Attribute

Issue
RollNo Name Date BookNo Name

Student Issue Book

Branch Sem Author Price

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 19
19 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Role
 Roles are indicated by labeling the lines that connect diamonds
(relationship) to rectangles (entity).
 The labels “Coordinator” and “Head” are called roles; they specify
Faculty entities interact with whom via Reports_To relationship
set.
 Role labels are optional, and are used to clarify semantics
(meaning) of the relationship.
EmpID Name

Coordinator
Faculty Reports_To
Head

Branch Experience

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 20
20 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Recursive Relationship Set
 The same entity participates in a relationship set more than once
then it is called recursive relationship set.

FacID FName DeptID DName

Faculty Works Department

Post Recursive
Relationship
FName Post Set DName
Ajay Professor Prof. Computer
rof.
Haresh Professor PProf./ Civil
Ramesh HOD HOD
Mechanical

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 21
21 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Mapping Cardinality (Cardinality Constraints)
 It represents the number of entities of another entity set which
are connected to an entity using a relationship set.
 It is most useful in describing binary relationship sets.
 For a binary relationship set the mapping cardinality must be one
of the following types:
1. One to One
2. One to Many
3. Many to One
4. Many to Many

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 22
22 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
One-to-One relationship (1 – 1)
 An entity in A is associated with only one entity in B and an entity
in B is associated with only one entity in A.

customer borrow loan


A1 B1
C1 L1
A2 B2
C2 L2

A B C3 L3

 Example: A customer is connected with only one loan using the


relationship borrower and a loan is connected with only one
customer using borrower.

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 23
23 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
One-to-Many relationship (1 – N)
 An entity in A is associated with more than one entities in B and
an entity in B is associated with only one entity in A.

customer borrow loan


A1 B1
C1 L1
A2 B2
C2 L2

A B C3 L3

L4

 Example: A loan is connected with only one customer using


borrower and a customer is connected with more than one loans
using borrower.

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 24
24 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Many-to-One relationship (N – 1)
 An entity in A is associated with only one entity in B and an entity
in B is associated with more than one entities in A.

customer borrow loan


A1 B1
C1 L1
A2 B2
C2 L2

A B C3 L3

C4
 Example: A loan is connected with more than one customer using
borrower and a customer is connected with only one loan using
borrower.

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 25
25 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Many-to-Many relationship (N – N)
 An entity in A is associated with more than one entities in B and
an entity in B is associated with more than one entities in A.

customer borrow loan


A1 B1
C1 L1
A2 B2
C2 L2

A B C3 L3

C4 L4
 Example: A customer is connected with more than one loan using
borrower and a loan is connected with more than one customer
using borrower.

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 26
26 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Exercise
Exercise

1. Give real life example of Mapping Cardinality.

Unit
Unit –– 2:
2: Relational
Relational Model
Model 27
27 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Participation Constraints
 It specifies the participation of an entity set in a relationship set.
 There are two types participation constraints
1. Total participation
2. Partial participation

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 28
28 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Total Participation v/s Partial Participation

Partial participation Total participation


• some entities in the entity set • every entity in the entity set
may not participate in any participates in at least one
relationship in the relationship relationship in the relationship
set. set.
• indicated by single line • indicated by double line

customer borrow loan

C1 L1
Each customer has
maximum one loan C2 L2

C3

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 29
29 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Weak Entity Set
 An entity set that does not have a primary key is called weak
entity set.
Payment-date

loan-no amount payment-no Payment-amount

loan L_P payment

Strong Entity Weak Entity Weak Entity


Set Relationship Set

• Weak entity set is indicated by double rectangle.


• Weak entity relationship set is indicated by double diamond.

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 30
30 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Weak Entity Set
 The existence of a weak entity set depends on the existence of a
strong entity set.
 The discriminator (partial key) of a weak entity set is the set of
attributes that distinguishes all the entities of a weak entity set.
 The primary key of a weak entity set is created by combining the
primary key of the strong entity set on which the weak entity set
is existence dependent and the weak entity set’s discriminator.
 We underline the discriminator attribute of a weak entity set with
a dashed line.
 Payment entity has payment-no which is discriminator.
 Loan entity has loan-no as primary key.
 So primary key for payment is (loan-no, payment-no).

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 31
31 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Superclass v/s Subclass
Super Class Sub Class
A superclass is an entity from which A subclass is an entity that is derived
another entities can be derived. from another entity.
E.g, E.g,
an entity account has two subsets saving_account and current_account
saving_account and current_account entities are derived from entity account.
So an account is superclass. So saving_account and current_account
are subclass.

Super Class
Account

Saving_Account Current_Account

Sub Class

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 32
32 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Generalization v/s Specialization
Generalization Specialization
• It extracts the common features of • It splits an entity to form multiple
multiple entities to form a new new entities that inherit some
entity. feature of the splitting entity.

Name Address Name Address

SPI Salary
Person Person
Name Name
ISA ISA
Address Address

Top-down approach
Bottom-up
approach

Student Faculty Student Faculty

SPI Salary SPI Salary

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 33
33 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Generalization v/s Specialization
Generalization Specialization
The process of creation of group from The process of creation of sub-groups
various entities is called generalization. within an entity is called specialization.
It is Bottom-up approach. It is Top-down approach.
The process of taking the union of two The process of taking a sub set of higher
or more lower level entity sets to level entity set to form a lower level
produce a higher level entity set. entity set.
It starts from the number of entity sets It starts from a single entity set and
and creates high level entity set using creates different low level entity sets
some common features. using some different features.

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 34
34 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Generalization & Specialization example
Name Address

PID City
Person

ISA

Salary Employee Customer Balance

ISA

Full Time Part Time

Days Worked Hour Worked

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 35
35 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Exercise
Exercise

1. Give any two examples of Generalization/Specialization.

Unit
Unit –– 2:
2: Relational
Relational Model
Model 36
36 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Constraints on Specialization and Generalization

Constraints

Disjoint Participation

Non-disjoint Total Partial


Disjoint
(Overlapping) (Mandatory) (Optional)

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 37
37 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Disjoint Constraint
 It describes relationship between members of the superclass and
subclass and indicates whether member of a superclass can be a
member of one, or more than one subclass.
 Types of disjoint constraints
1. Disjoint Constraint
2. Non-disjoint (Overlapping) Constraint

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 38
38 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Disjoint Constraint
 It specifies that the entity of a super class can belong to only one
lower-level entity set (sub class).
 Specified by ‘d’ or by writing disjoint near to the ISA triangle.
All the players are associated
Cricketer with only one sub class either
(Super class)
(Batsman or Bowler).

Batsman Bowler
(Sub class) (Sub class)

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 39
39 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Non-disjoint (Overlapping) Constraint
 It specifies that an entity of a super class can belong to more than
one lower-level entity set (sub class).
 Specified by ‘o’ or by writing overlapping near to the ISA triangle.
One player (Yuvraj singh) is
Cricketer associated with more than
(Super class)
one sub class.

Batsman Bowler
(Sub class) (Sub class)

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 40
40 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Representation of Disjoint & Non-disjoint in E-R diagram

Employee
(Super class)

Non-disjoint
Disjoint
In case of In case of
Disjoint constraint Non- disjoint constraint

ISA

Professor Head
(Sub class) (Sub class)

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 41
41 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Constraints on Specialization and Generalization

Constraints

Disjoint Participation
Constraint Constraint

Disjoint Non-disjoint Total Partial


Constraint (Overlapping) (Mandatory) (Optional)

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 42
42 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Participation (Completeness) Constraint
 It determines whether every member of super class must
participate as a member of subclass or not.
 Types of participation (Completeness) Constraint
1. Total (Mandatory) participation
2. Partial (Optional) participation

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 43
43 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Total (Mandatory) Participation
 Total participation specifies that every entity in the superclass
must be a member of some subclass in the specialization.
 Specified by a double line in E-R diagram.
All the players are associated
Cricketer with minimum one sub class
(Super class)
either (Batsman or Bowler).

Batsman Bowler
(Sub class) (Sub class)

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 44
44 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Partial (Optional) Participation
 Partial participation specifies that every entity in the super class
does not belong to any of the subclass of specialization.
 Specified by a single line in E-R diagram.

Cricketer
(Super class)

Batsman Not associated with Bowler


(Sub class) any sub class (Sub class)

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 45
45 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Representation of Total & Partial in E-R diagram

Vehicle
(Super class)
In case of In case of
Partial participation Total participation
(Single line) (Double line)

ISA

2 Wheeler 4 Wheeler
(Sub class) (Sub class)

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 46
46 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Limitation of E-R diagram
 In E-R model we cannot express relationships between two
relationships.

Relation 1 Relation Relation 2

Entity 1 Relation Entity 2

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 47
47 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Aggregation in E-R diagram
Customer
Company

Employee Works Department


Customer
Can not connect two relationship

Borrow Borrow

Loan Loan

Process of creating an entity by combining various components


of E-R diagram is called aggregation.

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 48
48 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
E-R diagram of Hospital
PatID Name HosID Name

Patient Admitted Hospital

Has Trea Has


ts

Medical Record Doctor

MRID Report Name DrID Dr Name

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 49
49 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
E-R diagram of Hospital
PatID Name HosID Name

Patient Admitted Hospital

RoomNo ISA Trea Has


ts

Indoor Outdoor
Doctor
Has
IPDID OPDID
DrID Dr Name
Charge Medical Record

MRID Report Name

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 50
50 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Reduce the E-R diagram to database schema
Step 1: Reduce Entities and Simple Attributes:
• An entity of an ER diagram is turned into a PersonID Name
table.
• Each attribute (except multi-valued
attribute) turns into a column (attribute) Person
in the table.
• Table name can be same as entity name. Address City
• Key attribute of the entity is the primary
key of the table which is usually PhoneNo
underlined.
• It is highly recommended that every table
should start with its primary key attribute
conventionally named as TablenameID. Person (PersonID, Name, Address, City)

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 51
51 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Reduce the E-R diagram to database schema
Step 2: Reduce Multi-valued Attributes:
• Multi-value attribute is turned into a new PersonID PhoneNo
table.
• Add the primary key column into multi-
value attribute’s table. Person
• Add the primary key column of the
parent entity’s table as a foreign key PhoneNo (PhoneID, PersonID, PhoneNo)
within the new (multi-value attribute’s)
table.
• Then make a 1:N relationship between Person (T1)
the Person table and PhoneNo table.

Having

PhoneNo (T2)

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 52
52 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Reduce the E-R diagram to database schema
Step 3: Reduce 1:1 Mapping Cardinality: WifeID WName
• Convert both entities in to table with
proper attribute.
• Place the primary key of any one table in Wife
to the another table as a foreign key.
• Place the primary key of the Wife table Having
WifeID in the table Persons as Foreign
key.
Person
OR
Place the primary key of the Person table
PersonID in the table Wife as Foreign key. PersonID PName

Person (PersonID, PName)


Wife (WifeID, Wname, PersonID)

Wife (WifeID, Wname)


Person (PersonID, Pname, WifeID)

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 53
53 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Reduce the E-R diagram to database schema
Step 3: Reduce 1:N Mapping Cardinality: HouseID HName
• Convert both entities in to table with
proper attribute.
• Place the primary key of table having 1 House
mapping in to the another table having
many cardinality as a Foreign key. Having
• Place the primary key of the Person table
PersonID in the table House as Foreign
key. Person

PersonID PName

Person (PersonID, PName)


House (HouseID, Hname, PersonID)

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 54
54 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Reduce the E-R diagram to database schema
Step 3: Reduce N:N Mapping Cardinality: ANo Balance
• Convert both entities in to table with
proper attribute.
• Create a separate table for relationship. Account
• Place the primary key of both entities
table into the relationship’s table as Has_Acct
foreign key.
• Place the primary key of the Customer
Customer
table CID and Account table Ano in the
table Has_Acct as Foreign key.
CID CName

Customer (CID, CName)


Account (ANo, Balance)
Has_Acct (HasAcctID, CID, ANo)

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 55
55 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Summery of Symbols used in E-R diagram
Customer Name Hold
Entity Attribute Relationship

EmpID Age PhoneNo


Primary Key Derived Multi Valued
Attribute Attribute Attribute

Payment PymtID Issue

Weak Entity Discriminating Weak Entity


Attribute Relationship
Role
Name
E R E R ISA

Total Role Specialization/


Participation Indicator Generalization

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 56
56 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Summery of Symbols used in E-R diagram
E R E ISA

One to One Total


Specialization/
E R E Generalization

One to Many Disjoint


ISA
E R E
Disjoint
Many to One Specialization/
Generalization
E R E
Overlapping
Many to Many ISA

Overlapping
Specialization/
Generalization

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 57
57 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Questions asked in GTU
1. Write a note on mapping cardinality in E-R diagram.
2. Explain the difference between a weak and a strong entity set.
3. Explain the difference between generalization and specialization.
4. Write a note on constraints on specialization and generalization.
5. Explain aggregation in E-R diagram with example.
6. Draw E-R diagram for bank management system.
7. Construct an E-R diagram for a car-insurance company whose
customers own one or more cars each. Each car has associated
with it zero to any number of recorded accidents.

Unit
Unit –– 3:
3: Entity-Relationship
Entity-Relationship Model
Model 58
58 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology

You might also like