Question
Given an instance of the STUDENTS relation as shown below:
| StudentID | StudentName | StudentEmail | StudentAge | CPI |
|---|---|---|---|---|
| 2345 | Shankar | shankar@math | X | 9.4 |
| 1287 | Swati | swati@ee | 19 | 9.5 |
| 7853 | Shankar | shankar@cse | 19 | 9.4 |
| 9876 | Swati | swati@mech | 18 | 9.3 |
| 8765 | Ganesh | ganesh@civil | 19 | 8.7 |
For (StudentName, StudentAge) to be a key for this instance, the value X should NOT be equal to _____.
Official answer and solution
- Official answer
- 19
- From
- Official GATE 2014 answer key
Solution
Apply the candidate key uniqueness constraint on the composite key attribute pair (StudentName, StudentAge).
-
Key Condition:
For(StudentName, StudentAge)to be a key for the relation instance, every tuple in the relation must have a unique pair of values for(StudentName, StudentAge). -
Existing Tuples:
- Tuple 1: (StudentID 2345):
StudentName = Shankar,StudentAge = X - Tuple 2: (StudentID 1287):
StudentName = Swati,StudentAge = 19 - Tuple 3: (StudentID 7853):
StudentName = Shankar,StudentAge = 19 - Tuple 4: (StudentID 9876):
StudentName = Swati,StudentAge = 18 - Tuple 5: (StudentID 8765):
StudentName = Ganesh,StudentAge = 19
- Tuple 1: (StudentID 2345):
-
Uniqueness Requirement for Tuple 1:
Tuple 3 already hasStudentName = ShankarandStudentAge = 19.
If , Tuple 1 would have(Shankar, 19), which duplicates Tuple 3, violating key uniqueness.
Therefore, should NOT be equal to .
19
Looking at StudentAge across other student names (like Swati or Ganesh) instead of the same student name Shankar.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2014 Computer Science and Information Technology (CS) Session 2
- Question
- 32 of 65, printed as CS Q.22
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.