Steps in Logical Data Model (LDM) : Student Course
Steps in Logical Data Model (LDM) : Student Course
Reg # S-Name
C-code C-Title
Works on
Works on Teaches
T-Name T-ID
P-Name
P-ID
Field
F-Name
F-ID
DBMS
2. Represent Relationship
Cs509 DBMS
2 Salman BSCS P2 2 502
Cs502 OS
3 509
Project Teacher
Field
F-ID F-Name
F-1 Programming
F-2 DataBase
DBMS
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
Employ
Manages
Employ
3 Zulqurnain Lecturer 9
5-Dr. Sher
9-Imran
3-Zulqurnain
DBMS
Employ
Manages
Employ
3 Zulqurnain Lecturer 5
5-Dr. Sher
9-Imran 3-Zulqurnain
DBMS
Employ
Manages
9-Imran
Vendor Product
Warehouse
S1 P3 WH7
S2 P9 WH8
S3 P3 WH4
DBMS