CS FundamentalsHardGATE CS · PSU (ISRO/BARC)

Entity sets Doctor, Patient and Drug participate in a single ternary relationship Prescribes with no cardinality constraints. Each entity set has its own key. What is the minimum number of tables, and what is the key of the Prescribes table?

  1. A. 6 tables; one per pair of entities
  2. B. 3 tables; Prescribes folded into Patient
  3. C. 4 tables; key = (doctor key, patient key)
  4. D. 4 tables; key = (doctor key, patient key, drug key)

Correct answer: D. 4 tables; key = (doctor key, patient key, drug key)

A many-many-many ternary relationship needs its own table whose key is the combination of all three participating keys; pairwise tables would not capture which drug was prescribed by which doctor to which patient.

More DBMS and SQL questions

Exams that ask this topic