Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1-When constructing an ERD for a PET entity, we make up our own primary key call

ID: 3914697 • Letter: 1

Question

1-When constructing an ERD for a PET entity, we make up our own primary key called "pet_id". We refer to this type of primary key as which of the following?

Lost key

Composite key

Virtual key

Simple key

2-

DOCTOR and PATIENT have a one-to-one relationship in which a PATIENT must see a doctor during an appointment, but a DOCTOR may have the appointment time free.  Which primary key, "doctor_id" or "patient_id" becomes the foreign key in the relationship?

doctor_id becomes the foreign key because the primary key on the "one" side of the relationship becomes the foreign key on the "many" side of the relationship.

patient_id becomes the foreign key because the primary key on the "one" side of the relationship becomes the foreign key on the "many" side of the relationship.

patient_id becomes the foreign key because a PATIENT must see a DOCTOR during the appointment time.

doctor_id becomes the foreign key because a PATIENT requires a doctor during an appointment time

Lost key

Composite key

Virtual key

Simple key

2-

DOCTOR and PATIENT have a one-to-one relationship in which a PATIENT must see a doctor during an appointment, but a DOCTOR may have the appointment time free.  Which primary key, "doctor_id" or "patient_id" becomes the foreign key in the relationship?

doctor_id becomes the foreign key because the primary key on the "one" side of the relationship becomes the foreign key on the "many" side of the relationship.

patient_id becomes the foreign key because the primary key on the "one" side of the relationship becomes the foreign key on the "many" side of the relationship.

patient_id becomes the foreign key because a PATIENT must see a DOCTOR during the appointment time.

doctor_id becomes the foreign key because a PATIENT requires a doctor during an appointment time

Explanation / Answer

Answer for part 1:-

There is no concept of LOST KEY in DBMS hence this cannot be the answer.

A COMPOSITE KEY is a key which uses more than 1 column. Since here only "pet_id" is used which is a single column , this cannot be a composite key and hence is not the answer.

There is no concept of VIRTUAL KEY in DBMS hence this cannot be the answer

Thus the answer is SIMPLE KEY

Answer for Part 2:-

Since it is a ONE TO ONE relationship, we can say that for every patient_id there must be a doctor_id.

Thus for every appointment we need a patient_id to be present . Thus it cannot be null and hence should be the primary key.

Thus D is the answer. ie. doctor_id becomes the foreign key because a PATIENT requires a doctor during an appointment time