0% found this document useful (0 votes)
44 views

Steps in Logical Data Model (LDM) : Student Course

The document outlines the steps to represent entity classes and relationships in a logical data model. It discusses different types of relationships such as one-to-one, one-to-many, and many-to-many. It also covers degrees of relationships like binary, unary, and ternary. Specific examples are provided to illustrate how to represent each type of relationship when modeling data, including using foreign keys and composite primary keys.

Uploaded by

Jahanzaib Niazi
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)
44 views

Steps in Logical Data Model (LDM) : Student Course

The document outlines the steps to represent entity classes and relationships in a logical data model. It discusses different types of relationships such as one-to-one, one-to-many, and many-to-many. It also covers degrees of relationships like binary, unary, and ternary. Specific examples are provided to illustrate how to represent each type of relationship when modeling data, including using foreign keys and composite primary keys.

Uploaded by

Jahanzaib Niazi
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/ 7

Steps in Logical Data Model (LDM)

Reg # S-Name
C-code C-Title

Student Registers Course


Registers

Works on
Works on Teaches

Project Supervise Teacher


Supervises
s

T-Name T-ID
P-Name
P-ID

Field

F-Name
F-ID
DBMS

www.bscs15.tk www.leemedia.tk www.ttdate.tk


1. Represent Entity Classes

2. Represent Relationship

1. Represent Entity Classes

Student Registration Course

R# Name Class P-ID R# C-Code

1 Yahya BSCS P1 1 509 C-code C-Title

Cs509 DBMS
2 Salman BSCS P2 2 502
Cs502 OS
3 509

Project Teacher

P-ID P-Name T-ID R# T-ID T-Name F-ID


P1 IIU-DB T2 1 T-1 Muhammad Imran F-2
P2 Transport T1 2 T-2 Zulqurnain Hashmi F-1

Field

F-ID F-Name

F-1 Programming

F-2 DataBase
DBMS

www.bscs15.tk www.leemedia.tk www.ttdate.tk


2. Representing Relationship

In order to represent the relationship we consider type of relationship (1:1. 1:M, M:N)
and degree of relationship (Unary, Binary, Ternary).

a) Binary + 1:M
In this case we take the primary of one side as a foreign key in many side relation, as
we did in the Teacher and Project Tables above.

o Foreign Key
If we have two relations A & B, and we insert the primary key of relation A
into relation B, (as a foreign key) to create the relations A and B, then the
inserted key in relations B is known as foreign key and it can have NULL or
duplicate value.

b) Binary + 1:1
In this case we take the primary key of any side as a foreign key in the other side
relation or even in both, as we did in the Project and Student Table above.

c) Binary + 1:M
In this case we create a new table having the primary keys of both relations as a
composite primary key, as we did with the Student and Course Table above.
DBMS

www.bscs15.tk www.leemedia.tk www.ttdate.tk


d) Unary + 1:1
In this case we insert the primary key in the same relation as a recursive foreign key
with different name in the same relation.
o Recursive Foreign Key
It is the foreign key that is the primary key of the same relation but inserted
to show the relationship and set the properties of the recursive foreign key
as “index = Yes (No Duplicate)”.

Employ

Manages

Employ

E-no E-name E-Designation Manager No

3 Zulqurnain Lecturer 9

5 Dr. Sher Professor 7

7 Dr. Riaz Professor

9 Imran Assistant Professor 5

Index = yes (No Duplicate) (In MS ACCESS)


7-Dr. Riaz

5-Dr. Sher

9-Imran

3-Zulqurnain
DBMS

www.bscs15.tk www.leemedia.tk www.ttdate.tk


e) Unary + 1:M
It is the foreign key that is the primary key of the same relation but inserted to show
the relationship and set the properties of the recursive foreign key as “index = Yes
(Duplicate OK)”

Employ

Manages

Employ

E-no E-name E-Designation Manager No

3 Zulqurnain Lecturer 5

5 Dr. Sher Professor 7

7 Dr. Riaz Professor

9 Imran Assistant Professor 5

Index = yes (Duplicate OK) (In MS ACCESS)


7-Dr. Riaz

5-Dr. Sher

9-Imran 3-Zulqurnain
DBMS

www.bscs15.tk www.leemedia.tk www.ttdate.tk


f) Unary M:N
In this case we create a new table having the primary key of first table along with the
same key with different name, both forming the composite primary key.

Employ

Manages

Employ Manager Info

E-no E-name E-Designation


E-No Manager No
3 Zulqurnain Lecturer
9 5
5 Dr. Sher Professor
9 7
7 Dr. Riaz Professor
8 9
9 Imran Assistant Professor
3 9
8 Shahbaz Professor

7-Dr. Riaz 5-Dr. Sher

9-Imran

8-Shahbaz 3-Zulqurnain Hashmi


DBMS

www.bscs15.tk www.leemedia.tk www.ttdate.tk


g) N-ary
We will make a new table having the primary keys of all related relations as a
composite primary key.

Vendor Product

Warehouse

Vendor ID Product ID Warehouse ID

S1 P3 WH7

S2 P9 WH8

S3 P3 WH4
DBMS

www.bscs15.tk www.leemedia.tk www.ttdate.tk

You might also like