0% found this document useful (0 votes)
79 views12 pages

Database Management System 10: Conversion of ER Model To Relational Model

1. An ER diagram can be converted to a relational schema by representing entities as tables and relationships as links between tables. 2. Strong entities become tables with their attributes and primary key. Weak entities include the primary key of their parent entity. 3. Relationships are modeled with additional tables for many-to-many relations and foreign keys for many-to-one/one-to-many.

Uploaded by

089ASHUTOSH PATI
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)
79 views12 pages

Database Management System 10: Conversion of ER Model To Relational Model

1. An ER diagram can be converted to a relational schema by representing entities as tables and relationships as links between tables. 2. Strong entities become tables with their attributes and primary key. Weak entities include the primary key of their parent entity. 3. Relationships are modeled with additional tables for many-to-many relations and foreign keys for many-to-one/one-to-many.

Uploaded by

089ASHUTOSH PATI
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/ 12

Conversion of ER

model to Relational
Model
Chittaranjan Pradhan

Database Management
Conversion of ER

System 10 model to Relational


Model

Conversion of ER model to
Relational Model

Chittaranjan Pradhan
School of Computer Engineering,
KIIT University
10.1
Conversion of ER
Conversion of ER model to Relational Model model to Relational
Model
Chittaranjan Pradhan
Conversion of ER model to Relational Model
A database that conforms to an ER diagram schema can be Conversion of ER
model to Relational
represented by a collection of relational schemas. Both the ER Model

model and Relational data model are abstract, logical


representations of real-world enterprises

1. Representation of Strong Entity sets


A strong entity set reduces to a schema with the same
attributes. The primary key of the entity set serves as the
primary key of the resulting schema

Loan = (loan_no, amount)


10.2
Conversion of ER
Conversion of ER model to Relational Model... model to Relational
Model
Chittaranjan Pradhan

2. Representation of Weak Entity sets Conversion of ER


model to Relational
Model
A weak entity set becomes a table that includes a column for
the primary key of the identifying strong entity set. The primary
key is constructed by the collection of foreign key and partial
key

Loan = (loan_no, amount)


Payment = (loan_no, payment_no, payment_date,
payment_amt)

10.3
Conversion of ER
Conversion of ER model to Relational Model... model to Relational
Model
Chittaranjan Pradhan
3. Representation of Relationship sets
Conversion of ER
model to Relational
3.a. Binary M:N Model

Union of the primary key attributes from the participating entity


sets becomes the primary key of the relationship

Customer = (cid, cname, address)


Loan = (loan_no, amount)
Borrow = (cid, loan_no)
If borrow_date is mentioned as descriptive attribute, then
Borrow = (cid, loan_no, borrow_date)
10.4
Conversion of ER
Conversion of ER model to Relational Model... model to Relational
Model
Chittaranjan Pradhan
3.b. Binary M:1/1:M
Construct two tables, one for the entity set at 1 side and Conversion of ER
model to Relational
another for entity set at M side, add the descriptive attributes Model

and a reference of the primary key of 1 side to the entity set at


M side

Stud = (roll, name, branch)


Library = (bid, bname, price, roll)
The foreign key can be represented by specifying the name as:
Library = (bid, bname, price, borrowing_roll)
If borrow_date is the descriptive attribute, then
Library = (bid, bname, price, borrowing_roll, borrow_date)
10.5
Conversion of ER
Conversion of ER model to Relational Model... model to Relational
Model
Chittaranjan Pradhan
3.c. Binary 1:1
Construct two tables. In this case, either side can be chosen to Conversion of ER
act as the many side. That is, extra attributes can be added to model to Relational
Model
either of the tables corresponding to the two entity sets, but not
at the same time

Employee = (eid, ename, address, did)


Department = (did, dname, location)
If it is required to mention the relationship name, then
Employee = (eid, ename, address, manager_did)
If department entity set will be considered as many side, then
Employee = (eid, ename, address)
Department = (did, dname, location, manager_eid)
10.6
Conversion of ER
Conversion of ER model to Relational Model... model to Relational
Model
Chittaranjan Pradhan

4. Representation of Recursive Relationship sets


Conversion of ER
model to Relational
Two tables will be constructed; one for entity set and one for Model

relationship set

Employee = (eid, ename, address)


Works_for = (mgrid, workerid)
This ER diagram can also be represented by using a single
relation schema. In such cases, the schema contains a foreign
key for each tuple in the original entity set
Employee = (eid, ename, address, manager_id)

10.7
Conversion of ER
Conversion of ER model to Relational Model... model to Relational
Model
Chittaranjan Pradhan

Conversion of ER
model to Relational
Model
5. Representation of Composite attributes
The composite attributes are flattened out by creating a
separate attribute for each of its parts

Customer = (cid, name, address_street, address_city,


address_pin)

10.8
Conversion of ER
Conversion of ER model to Relational Model... model to Relational
Model
Chittaranjan Pradhan

Conversion of ER
model to Relational
6. Representation of Multi-valued attributes Model

A multi-valued attribute M of an entity set E is represented by a


separate schema E_M as E_M(primary key of E,M)

Employee = (eid, name, address)


Employee_phone_no = (eid, phone_no)

10.9
Conversion of ER
Conversion of ER model to Relational Model... model to Relational
Model
Chittaranjan Pradhan
7. Representation of Generalization/Specialization
In case of generalization/specialization-related ER diagram, Conversion of ER
model to Relational
one schema will be constructed for the generalized entity set Model

and the schemas for each of the specialized entity sets

Person = (person_id, name, address)


Employee = (person_id, salary)
Customer = (person_id, credit_rating)
10.10
Conversion of ER
Conversion of ER model to Relational Model... model to Relational
Model
Chittaranjan Pradhan

Conversion of ER
model to Relational
Model

Representation of Generalization/Specialization...
When the generalization/specialization is a disjointness case,
the schemas are constructed only for the specialized entity sets

Employee = (employee_id, name, address, salary)


Customer = (customer_id, name, address, credit_rating)

10.11
Conversion of ER
Conversion of ER model to Relational Model... model to Relational
Model

8. Representation of Aggregation Chittaranjan Pradhan

To represent aggregation, create a schema containing the


Conversion of ER
primary key of the aggregated relationship, primary key of the model to Relational
Model
associated entity set and descriptive attributes (if any)

Employee = (eid, name, address)


Branch = (bid, bname, asset)
Job = (jobid, position, responsibility)
Works_on = (eid, bid, jobid)
Manager = (mid, mgrname)
Manages = (eid, bid, jobid, mid) 10.12

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy