Skip to content
Official PYQ · 2025

GATE CS 2025 Set 2 Q44 — Tuple Calculus and SQL

Explain with AI

Consider the following relational schema: 

Students (rollno: integer‾,\underline{\text{rollno: integer}}, name: string, age: integer, cgpa: real) 

Courses (courseno: integer‾,\underline{\text{courseno: integer}}, cname: string, credits: integer) 

Enrolled (rollno: integer‾,\underline{\text{rollno: integer}}, courseno: integer‾,\underline{\text{courseno: integer}}, grade: string) 

Which of the following options is/are correct SQL query/queries to retrieve the names of the students enrolled in course number (i.e., courseno) 14701470? 

Select all correct options
View worked solution

Answer: A;C;D

To find the names of students enrolled in course number 1470, we analyze each SQL query option:

  • Option A (Correct): This query uses a correlated subquery with the EXISTS operator. For each student S, the subquery checks if there is any record in the Enrolled table with courseno = 1470 and rollno = S.rollno. If such a record exists, the student's name is selected. This is a standard and correct SQL query.
  • Option B (Incorrect): The keyword SIZEOF is not a valid standard SQL operator or function for determining the cardinality of a subquery result set. Therefore, this query is syntactically invalid.
  • Option C (Correct): This query uses a correlated subquery with COUNT(*). It counts the number of enrollment records for student S in course 1470. If this count is strictly greater than 0, it indicates the student is enrolled in the course, and their name is retrieved. This is logically correct and valid SQL.
  • Option D (Correct): A NATURAL JOIN between Students and Enrolled automatically joins the two tables on their common attribute, which is rollno. The query then filters the joined rows where courseno = 1470 and projects the student's name (S.name). This correctly retrieves the desired names.

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

Published
Report a correction
Keep exploringMore Tuple Calculus and SQL questions