Q.Name foreign keys in table ATTENDANCE and STUDENT. Is there any foreign key in table GUARDIAN.
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →ATTENDANCE has one foreign key: RollNumber (references STUDENT.RollNumber). STUDENT has one foreign key: GUID (references GUARDIAN.GUID).
GUARDIAN has no foreign key — it refers to no other table, which is exactly why it is populated first.
Foreign key in ATTENDANCE
Table 8.5 marks RollNumber of ATTENDANCE as FOREIGN KEY: each attendance record must belong to an existing student, so it references the primary key RollNumber of STUDENT.
ALTER TABLE ATTENDANCE
ADD FOREIGN KEY(RollNumber) REFERENCES STUDENT(RollNumber);
Foreign key in STUDENT
Table 8.3 marks GUID of STUDENT as FOREIGN KEY: each student's guardian must exist in GUARDIAN, so GUID references the primary key GUID of GUARDIAN. This is the statement the chapter itself runs:
ALTER TABLE STUDENT
ADD FOREIGN KEY(GUID) REFERENCES GUARDIAN(GUID);
Is there a foreign key in GUARDIAN?
No. Look at Table 8.4 — GUARDIAN's attributes (GUID, GName, GPhone, GAddress) carry PRIMARY KEY, NOT NULL and UNIQUE constraints, but no FOREIGN KEY. A foreign key exists only when a table refers to another table's primary key, and GUARDIAN doesn't depend on any other table; in this schema it is the table others point to (the referenced table), never the one pointing. …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.