0% found this document useful (0 votes)
62 views20 pages

Relational Model

The document discusses mapping entity relationship diagrams to relational schemas. It covers mapping strong entity sets, weak entity sets, and different relationship types including 1:1, 1:N, M:N, and recursive relationships. Attributes are mapped as columns in tables and relationships are represented using foreign key constraints. Primary keys are preserved and composite or multivalued attributes are normalized.

Uploaded by

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

Relational Model

The document discusses mapping entity relationship diagrams to relational schemas. It covers mapping strong entity sets, weak entity sets, and different relationship types including 1:1, 1:N, M:N, and recursive relationships. Attributes are mapped as columns in tables and relationships are represented using foreign key constraints. Primary keys are preserved and composite or multivalued attributes are normalized.

Uploaded by

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

Fundamentals of

DBMS
by …
Dr. Kasturi Dhal
Silicon Institute of Technology
Bhubaneswar

11/22/2023 Dr.Kasturi Dhal 1


1-Mapping of Strong Entity Set
• A strong entity set reduces to a relational schema schema with the same
attributes.
– Composite Attributes: Use only their
• simple, component of composite attributes

11/22/2023 Dr.Kasturi Dhal 2


• Convert the following ER diagram into
relational schema
ename
eid
eloc

emp dept

Relational schema Employee

eid ename eloc dept


1-Mapping of Strong Entity Set

• Multivalued Attribute:
– For each multi-valued attribute A in strong entity set E creates a
separate relation or table R with A as an attribute and primary key of
E as foreign key in R

11/22/2023 Dr.Kasturi Dhal 4


• Convert the following ER diagram into
relational schema
ename
eid
phone
no

emp
Relational schema
employee_phone
employee
eid enme eid phone
1-Mapping of Strong Entity Set

• Mapping a Derived attribute

COURSE
courseno equip subject

11/22/2023 Dr.Kasturi Dhal 6


2-Mapping of Weak Entity Set

• For each weak entity set W with owner entity


type E, create a separate relation or table R
with all the attributes of W along with primary
key of E as foreign key taken from the owner
entity E.
• Primary key of R is composed of the
discriminator and all the remaining attributes
of the weak entity plus the primary key of the
owner entity as foreign key of R on which it is
existent dependent.
11/22/2023 Dr.Kasturi Dhal 7
2-Mapping of Weak Entity Set

11/22/2023 Dr.Kasturi Dhal 8


• Convert the following ER diagram into
relational schema
payamo
paydate
payno unt
loanno amount

1 n
loanpaym Payment
ent
loan

loan Relational schema


payment
loanno amount
loanno Payno paydate payamo
unt
3) Mapping a binary 1 : 1 relationship

• For each binary 1:1 relationship type R in the ER


schema, identify participating entity type S and
T of R.
• Add Primary key of one participating relation as
the foreign key of the other participating
relation
– If only one participating type is total participation
then primary key of the parital participation side
becomes the foreign key of the total participation
side.
11/22/2023 Dr.Kasturi Dhal 10
3) Mapping a binary 1 : 1 relationship

EMPLOYEE

SSN Bdate Fname Minit Lname address salary

Dnumber Name Mgrssn Startdate


DEPARTMENT

11/22/2023 Dr.Kasturi Dhal 11


3) Mapping a binary 1 : 1 relationship

Nurse-
name dob center Locati Date-
id
name on asigned

Nurse incharge
carecenter

nurse carecenter
Nurseid Name dob center Locatio dateas nurseid
name n signed

11/22/2023 Dr.Kasturi Dhal 12


4) Mapping a binary 1 : N relationship

• For each binary 1:N relationship type R in the


ER schema, identify participating entity type S
at N side.
• Include the primary key of T(entity type at 1
side) as the foreign key of S(manyside).
• Include the descriptive attribute of R in the
table S.

11/22/2023 Dr.Kasturi Dhal 13


4) Mapping a binary 1 : N relationship

startdartd
ate

EMPLOYEE
SSN Bdate Fname Minit Lname address salary DNO

Dnumber Name Startdate

DEPARTMENT

11/22/2023 Dr.Kasturi Dhal 14


4) Mapping a binary 1 : N relationship

customer order
custid name custadd orderid orderdate custid

11/22/2023 Dr.Kasturi Dhal 15


5) Mapping a binary M : N relationship

• For each binary M:N relationship type R with


participating entity type S and T, creates a new
relation or table R1 to represent R.
• Include primary key of S and T as the foreign
key of R1.
• Primary key of R1 is the combination of
primary key of R and S.
• Include the descriptive attribute of R in the
table R1.
11/22/2023 Dr.Kasturi Dhal 16
5) Mapping a binary M : N relationship

EMPLOYEE

SSN Bdate Fname Minit Lname address salary

EmpSSN Pnumber Hours WORKS-ON

Pno Pname Plocation PROJECT

11/22/2023 Dr.Kasturi Dhal 17


5) Mapping a binary M : N relationship

Order Product
Order_id Order_date Product_id Unit_price

Requests
Order_id Product_id Quantity

11/22/2023 Dr.Kasturi Dhal 18


• Convert the following ER diagram into
relational schema
coursec cname
date
sid name ode

m n
Registers course
student

student Relational schema course


Sid name ccode cname

Sid coursecode date Registers


5) Mapping a recursive relationship

empid name sal

Emp

Supervisor 1 N Supervisee

Supervises Relational schema


Emp

empid Name sal supvid

You might also like