Skip to content
Exercises · Q12
Q.

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

Student Project Database

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

Table: STUDENT

Roll NoNameClassSectionRegistration_ID
11MohanXI1IP-101-15
12SohanXI2IP-104-15
21JohnXII1CS-103-14
22MeenaXII2CS-101-14
23JuhiXII2CS-101-10
  1. Name primary key of each table.
  2. Find foreign key(s) in table PROJECT-ASSIGNED.
  3. Is there any alternate key in table STUDENT? Give justification for your answer.
  4. Can a user assign duplicate value to the field RollNo of STUDENT table? Jusify.
Puducherry CbseNCERTSubjective· 4mImportance★★★★★
45% · 13/29 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 →

This solution identifies primary keys, foreign keys, and alternate keys in the given database schema, and explains the uniqueness constraint on primary keys.

Understanding the structure of a database, specifically its keys, is fundamental to designing efficient and reliable systems. Keys define relationships between tables and enforce data integrity, ensuring that data is consistent and accurate. Let's break down the concepts for the STUDENT-PROJECT database.

(a) Name primary key of each table.

A primary key is a column or a set of columns that uniquely identifies each row in a table. It must contain unique values for each row and cannot contain NULL values. Its purpose is to ensure entity integrity, meaning every entity (row) in the table is uniquely identifiable.

  • Table: PROJECT

    The ProjectNo column contains unique values (101, 102, 103, 104, 105, 106) for each project and does not appear to have any NULL values. It serves as a clear identifier for each project.

    Important

    The primary key for the PROJECT table is ProjectNo.

  • Table: PROJECT ASSIGNED

    This table links students to projects. Neither Registration_ID nor ProjectNo alone can uniquely identify a row, as a student might be assigned multiple projects (though not shown in this sample, it's a possibility in a real system), or a project might be assigned to multiple students. However, the combination of Registration_ID and ProjectNo uniquely identifies each assignment record. For example, (IP-101-15, 101) is a unique pair.

    Important

    The primary key for the PROJECT ASSIGNED table is the composite key (Registration_ID, ProjectNo).

  • Table: STUDENT

    The Roll No column contains unique values (11, 12, 21, 22, 23) for each student and does not contain NULL values. It is the most natural and common identifier for students in an academic context.

    Important

    The primary key for the STUDENT table is Roll No.

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

A foreign key is a column or a set of columns in one table that refers to the primary key in another table. It establishes a link between two tables, enforcing referential integrity. This means that values in the foreign key column(s) must either match a value in the primary key of the referenced table or be NULL (if allowed).

In the PROJECT ASSIGNED table:

  • The Registration_ID column contains values like 'IP-101-15', 'IP-104-15', 'CS-103-14', etc. These values correspond to the Registration_ID column in the STUDENT table, which is an alternate key (and a candidate for a primary key) in that table. This establishes a link between an assignment and a specific student.
  • The ProjectNo column contains values like 101, 103, 102, etc. These values correspond to the ProjectNo column in the PROJECT table, which is its primary key. This establishes a link between an assignment and a specific project.

Therefore, PROJECT ASSIGNED has two foreign keys.

Important

The foreign keys in the PROJECT ASSIGNED table are Registration_ID (referencing STUDENT table) and ProjectNo (referencing PROJECT table).

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

An alternate key is any candidate key that is not chosen as the primary key for a table. A candidate key is a minimal set of attributes that can uniquely identify a tuple (row) in a table. It must be unique and non-nullable.

In the STUDENT table:

  • We identified Roll No as the primary key because it uniquely identifies each student.
  • Consider the Registration_ID column. Its values ('IP-101-15', 'IP-104-15', 'CS-103-14', 'CS-101-14', 'CS-101-10') are unique for each student in the table and do not contain NULL values. This means Registration_ID also has the properties of a candidate key.

Since Registration_ID is a candidate key but Roll No was chosen as the primary key, Registration_ID qualifies as an alternate key.

Important

Yes, Registration_ID is an alternate key in the STUDENT table.

…

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.