Skip to content
Official PYQ · 2014

GATE CS 2014 Set 2 Q22 — Integrity Constraints

Explain with AI
Given an instance of the STUDENTS relation as shown as below

StudentIDStudentNameStudentEmailStudentAgeCPI2345Shankarshankar@mathX9.41287Swatiswati@ee199.57853Shankarshankar@cse199.49876Swatiswati@mech189.38765Ganeshganesh@civil198.7\begin{array}{|c|c|c|c|c|} \hline \textbf{StudentID} & \textbf{StudentName} & \textbf{StudentEmail} & \textbf{StudentAge} & \textbf{CPI} \\ \hline \text{2345} & \text{Shankar} & \text{shankar@math} & \text{X} & \text{9.4}\\ \hline\text{1287} & \text{Swati} & \text{swati@ee} & \text{19} & \text{9.5}\\ \hline\text{7853} & \text{Shankar} & \text{shankar@cse} & \text{19} & \text{9.4} \\ \hline \text{9876} & \text{Swati} & \text{swati@mech} & \text{18} & \text{9.3} \\ \hline \text{8765} & \text{Ganesh} & \text{ganesh@civil} & \text{19} & \text{8.7} \\ \hline \end{array}
For (StudentName, StudentAge)(\text{StudentName, StudentAge}) to be a key for this instance, the value XX should NOT be equal to______.
View worked solution

Answer: 19

For a set of attributes to be a key for a relation instance, the values of those attributes must be unique for every tuple in that instance.

Let us list the values of the attribute pair (StudentName,StudentAge)(\text{StudentName}, \text{StudentAge}) for each of the five tuples in the given relation:

  1. (Shankar,X)(\text{Shankar}, X)
  2. (Swati,19)(\text{Swati}, 19)
  3. (Shankar,19)(\text{Shankar}, 19)
  4. (Swati,18)(\text{Swati}, 18)
  5. (Ganesh,19)(\text{Ganesh}, 19)

For (StudentName,StudentAge)(\text{StudentName}, \text{StudentAge}) to be a key, all five pairs must be distinct:

  • Comparing tuple 1 and tuple 3: if X=19X = 19, both tuples will have the same pair (Shankar,19)(\text{Shankar}, 19). This violates the uniqueness property of a key.
  • For any value of X≠19X \neq 19, the pair (Shankar,X)(\text{Shankar}, X) remains unique in the relation.

Thus, the value of XX should NOT be equal to 19.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Integrity Constraints questions