← RGPV CS-502 DBMS November 2023 solved question paper
RGPV CS-502 (GS) | November 2023 | Q2(a) | 7 marks
Question (restated): Map E1(a,b) and E2(c,d) to relations when R1 requires each E1 to reference one E2 and R2 requires each E2 to reference one E1.
Answer
Assume a and c are the primary keys of E1 and E2 respectively. The arrows in the ER diagram indicate the at-most-one side of each relationship, while double lines indicate total participation. In R1, every E1 participates and points to at most one E2; hence every E1 references exactly one E2. In R2, every E2 participates and points to exactly one E1. The two relationships are independent and need not be inverses.
A many-to-one relationship without attributes can be represented by placing the primary key of the one-side entity as a foreign key in the many-side table. Total participation requires that foreign key to be NOT NULL.
| Relation | Attributes | Constraints |
|---|---|---|
| E1 | a, b, r1_c | PK a; FK r1_c → E2(c); NOT NULL |
| E2 | c, d, r2_a | PK c; FK r2_a → E1(a); NOT NULL |
E1(a PRIMARY KEY, b, r1_c NOT NULL REFERENCES E2(c)) E2(c PRIMARY KEY, d, r2_a NOT NULL REFERENCES E1(a))
For example E1 rows (1,B,10), (2,C,10) and E2 row (10,D,1) satisfy both relationships. R1 allows multiple E1 rows to refer to E2=10; R2 identifies one E1 for that E2. No UNIQUE constraint should be added to the foreign keys unless an additional one-to-one restriction is specified.
Because the foreign keys form a cycle, implementation may require deferred constraint checking or a staged loading procedure. An alternative uses separate R1(a,c) and R2(c,a) relations with primary keys a and c respectively, but total participation then requires additional enforcement. The embedded foreign-key representation is compact and directly enforces mandatory references.

Further reading: Silberschatz, Korth and Sudarshan, Database System Concepts; Elmasri and Navathe, Fundamentals of Database Systems.
Discussion
Ask a question, share your thoughts or report an error.
Sign in to participate in the discussion.
Join the discussion