Skip to content
Exercises · Q12
Q.

For the above given database STUDENT-PROJECT, answer the following:

Student Project Database

Table: STUDENT

Roll NoNameClassSectionRegistration_ID
11MohanXI1IP-101-15
12SohanXI2IP-104-15
21JohnXII1CS-103-14
22MeenaXII2CS-101-14
23JuhiXII2CS-101-10

Table: PROJECT

ProjectNoPNameSubmissionDate
101Airline Database12/01/2018
102Library Database12/01/2018
103Employee Database15/01/2018
104Student Database12/01/2018
105Inventory Database15/01/2018
106Railway Database15/01/2018

Table: PROJECT ASSIGNED

Registration_IDProjectNo
IP-101-15101
IP-104-15103
CS-103-14102
CS-101-14105
CS-101-10104

a) Name primary key of each table.

b) Find foreign key(s) in table PROJECT-ASSIGNED.

c) Is there any alternate key in table STUDENT? Give justification for your answer.

d) Can a user assign duplicate value to the field RollNo of STUDENT table? Jusify.

Yanam CbseNCERTSubjective· 4mImportance★★★★★est
93% · 13/14 Questions
🔒 Locked · start free trial →

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 →

A primary key uniquely identifies every row, an alternate key is a candidate key that was not chosen as the primary key, and a foreign key links a row to a row of another table.

Here: STUDENT → RollNo, PROJECT → ProjectNo, PROJECT-ASSIGNED → Registration_ID; both columns of PROJECT-ASSIGNED are foreign keys; Registration_ID is STUDENT's alternate key; and a duplicate RollNo is impossible because the DBMS enforces primary-key uniqueness.

a) Primary key of each table

A primary key must be unique and non-NULL for every row. Scan each table's data:

TablePrimary keyWhy it qualifies
STUDENTRollNo11, 12, 21, 22, 23 — one distinct number per student
PROJECTProjectNo101–106 — every project is numbered exactly once
PROJECT-ASSIGNEDRegistration_IDeach registration ID appears in exactly one assignment row

(If the school ever allowed one student to work on several projects, Registration_ID alone would repeat, and the composite key (Registration_ID, ProjectNo) would be needed. With the given one-project-per-student data, Registration_ID suffices.)

b) Foreign key(s) in PROJECT-ASSIGNED

Both of its columns point at rows of other tables:

  • Registration_ID → references Registration_ID of STUDENT
  • ProjectNo → references ProjectNo of PROJECT

That is exactly what makes PROJECT-ASSIGNED a linking table: every value it stores must already exist in the parent tables (referential integrity).

c) Alternate key in STUDENT

Yes — Registration_ID. STUDENT actually has two candidate keys: RollNo and Registration_ID. Check the data: IP-101-15, IP-104-15, CS-103-14, CS-101-14, CS-101-10 are all different, and a registration ID identifies exactly one student. Since RollNo was picked as the primary key, the remaining candidate key — Registration_ID — is by definition the alternate key. (Name, Class, Section cannot be keys: two students could easily share any of them.)

d) Can a user give RollNo a duplicate value?

No. RollNo is the primary key of STUDENT, and a DBMS enforces uniqueness (and NOT NULL) on the primary key automatically. This is how the table is declared and what happens on the attempt:

CREATE TABLE STUDENT (
    RollNo          INT PRIMARY KEY,
    Name            VARCHAR(30),
    Class           VARCHAR(5),
    Section         INT, …

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.