chapter
    Relational Algebra, Tuple Calculus and SQL PYQs for GATE CS

    Solve 11+ Relational Algebra, Tuple Calculus and SQL previous year questions for GATE CS with answers and detailed solutions. Free sample questions below.

    Try a question

    Answer it here to see how it works. Nothing is recorded until you sign in.

    Question 1
    2026 Slot Set1 PYQ
    Consider a relational database schema with two relations and .

    Let be a tuple relational calculus expression.

    Which one of the following relational algebraic expressions is equivalent to ?
    Question 2
    2025 Slot Set2 PYQ
    Consider the following relational schema:

    Students (rollno: integer, name: string, age: integer, cgpa: real)

    Courses (courseno: integer, cname: string, credits: integer)

    Enrolled (rollno: integer, 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) 1470?
    Question 3
    2025 Slot Set1 PYQ
    Consider two relations describing and in a sports league:

    • : are team-id and team-name, respectively
    • : , and denote player-id, player-name and the team-id of the player, respectively

    Which ONE of the following tuple relational calculus queries returns the name of the players who play for the team having as ‘’?
    Question 4
    2025 Slot Set1 PYQ
    Consider the following database tables of a sports league.

    player(pid,pname,age)                    team(tid,tname,city,cid)
    coach(cid,cname)                           members(pid,tid)

    An instance of the table and an SQL query are given.

    playercoachteammemberspidpnameage1Jasprit312Atharva243Ishan264Axar30cidcname101Ricky102Mark103Trevortidtnamecitycid10MIMumbai10220DCDelhi10130PKMohali103pidtid110230310420

    SELECT MIN(P.age)
    FROM player P
    WHERE P.pid IN (
        SELECT M.pid
        FROM team T, coach C, members M
        WHERE C.cname = 'Mark'
              AND T.cid = C.cid
              AND M.tid = T.tid
    )

    The value returned by the given SQL query is ______. (Answer in integer)
    Question 5
    2024 Slot Set2 PYQ
    The relation schema, Person(pid,city), describes the city of residence for every person uniquely identified by pid. The following relational algebra operators are available: selection, projection, cross product, and rename.

    To find the list of cities where at least 3 persons reside, using the above operators, the minimum number of cross product operations that must be used is
    Question 6
    2024 Slot Set1 PYQ
    Consider the following two relations, and :

    R A B 10 20 20 30 30 40 30 50 50 95 S A C 10 90 30 45 40 80
    The total number of tuples obtained by evaluating the following expression is __________
    Question 7
    2022 PYQ
    Consider the relational database with the following four schemas and their respective instances.

    Student(sNo, sName, dNo)  Dept(dNo, dName)

    Course(cNo, cName, dNo)  Register(sNo, cNo)


    Student
    sNosNamedNo
    S01JamesD01
    S02RockyD01
    S03JacksonD02
    S04JaneD01
    S05MilliD02

    Dept
    dNodName
    D01CSE
    D02EEE

    Course
    cNocNamedNo
    C11DSD01
    C12OSD01
    C21DED02
    C22PTD02
    C23CVD03

    Register
    sNocNo
    S01C11
    S01C12
    S02C11
    S03C21
    S03C22
    S03C23
    S04C11
    S04C12
    S05C11
    S05C21


    SQL Query:

    SELECT * FROM Student AS S WHERE NOT EXIST
      (SELECT cNo FROM Course WHERE dNo = “D01”
            EXCEPT
       SELECT cNo FROM Register WHERE sNo = S.sNo)


    The number of rows returned by the above SQL query is___________.
    Question 8
    2022 PYQ
    Consider the following three relations in a relational database.



    Which of the following relational algebra expressions return the set of who own all the brands?
    Question 9
    2021 Slot Set2 PYQ
    The relation scheme given below is used to store information about the employees of a company, where empId is the key and deptId indicates the department to which the employee is assigned. Each employee is assigned to exactly one department.

    emp(empId, name, gender, salary, deptId)

    Consider the following SQL query:

    select deptId, count(*)
    from emp
    where gender = "female" and salary > (select avg(salary) from emp)
    group by deptId;

    The above query gives, for each department in the company, the number of female employees whose salary is greater than the average salary of
    Question 10
    2021 Slot Set1 PYQ
    The following relation records the age of 500 employees of a company, where empNo (indicating the employee number) is the key:


    Consider the following relational algebra expression:


    What does the above expression generate?
    Free preview ends here

    Login to view the complete previous-year questions and solutions

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Relational Algebra, Tuple Calculus and SQL PYQs for GATE CS

    Solve 11+ Relational Algebra, Tuple Calculus and SQL previous year questions for GATE CS with answers and detailed solutions. Free sample questions below.

    Chapter Roadmap: Relational Algebra, Tuple Calculus and SQL

    Chapter Roadmap

    Relational Algebra, Tuple Calculus and SQL

    By the end of this chapter, you will master the translation between declarative query languages and procedural operations, write complex SQL aggregations, and estimate query execution costs.

    1. Tuple Relational Calculus and RA Equivalence 2 PYQs

    Declarative querying, quantifiers, and translating TRC to Relational Algebra.

    2. SQL Queries, Joins and Aggregation 4 PYQs

    Writing complex nested queries, group by, having, and various join types.

    3. Relational Algebra Operations, Division and Self-Joins 4 PYQs

    Procedural query formulation, division operator, and self-join patterns.

    4. Selection Cardinality and Query Result Estimation 1 PYQ

    Estimating the number of tuples returned by selections and joins.

    Tuple Relational Calculus and RA Equivalence

    Tuple Relational Calculus and RA Equivalence

    Bridging the gap between declarative "what" and procedural "how" in database queries.

    Context: Relational Algebra, Tuple Calculus and SQL > Tuple Relational Calculus and Relational Algebra Equivalence

    What you will learn here:

    • The declarative syntax of Tuple Relational Calculus (TRC).
    • How existential and universal quantifiers map to relational algebra operations.
    • Step-by-step methods for translating TRC expressions into Relational Algebra.
    • Common traps involving free and bound variables.

    Relational Algebra, Tuple Calculus and SQL: Solved Questions with Step-by-Step Explanations (10 Problems)

    Question 1 · Databases · 2026_Set1 MCQ
    Consider a relational database schema with two relations and .

    Let be a tuple relational calculus expression.

    Which one of the following relational algebraic expressions is equivalent to ?
    1. A.

    2. B.

    3. C.

    4. D.

    Question 2 · Databases · 2025_Set2 MSQ
    Consider the following relational schema:

    Students (rollno: integer, name: string, age: integer, cgpa: real)

    Courses (courseno: integer, cname: string, credits: integer)

    Enrolled (rollno: integer, 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) 1470?
    1. A.

      <pre>SELECT S.name

      FROM Students S

      WHERE EXISTS (SELECT * FROM Enrolled E

      WHERE E.courseno = 1470

      AND E.rollno = S.rollno);</pre>

    2. B.

      <pre>SELECT S.name

      FROM Students S

      WHERE SIZEOF (SELECT * FROM Enrolled E

      WHERE E.courseno = 1470

      AND E.rollno = S.rollno) > 0;</pre>

    3. C.

      <pre>SELECT S.name

      FROM Students S

      WHERE 0 &lt; (SELECT COUNT(*)

      FROM Enrolled E

      WHERE E.courseno = 1470

      AND E.rollno = S.rollno);</pre>

    4. D.

      <pre>SELECT S.name

      FROM Students S NATURAL JOIN Enrolled E

      WHERE E.courseno = 1470;</pre>

    Question 3 · Databases · 2025_Set1 MCQ
    Consider two relations describing and in a sports league:

    • : are team-id and team-name, respectively
    • : , and denote player-id, player-name and the team-id of the player, respectively

    Which ONE of the following tuple relational calculus queries returns the name of the players who play for the team having as ‘’?
    1. A.

    2. B.

    3. C.

    4. D.

    Question 4 · Databases · 2025_Set1 NAT
    Consider the following database tables of a sports league.

    player(pid,pname,age)                    team(tid,tname,city,cid)
    coach(cid,cname)                           members(pid,tid)

    An instance of the table and an SQL query are given.

    playercoachteammemberspidpnameage1Jasprit312Atharva243Ishan264Axar30cidcname101Ricky102Mark103Trevortidtnamecitycid10MIMumbai10220DCDelhi10130PKMohali103pidtid110230310420

    SELECT MIN(P.age)
    FROM player P
    WHERE P.pid IN (
        SELECT M.pid
        FROM team T, coach C, members M
        WHERE C.cname = 'Mark'
              AND T.cid = C.cid
              AND M.tid = T.tid
    )

    The value returned by the given SQL query is ______. (Answer in integer)
    Question 5 · Databases · 2024_Set2 MCQ
    The relation schema, Person(pid,city), describes the city of residence for every person uniquely identified by pid. The following relational algebra operators are available: selection, projection, cross product, and rename.

    To find the list of cities where at least 3 persons reside, using the above operators, the minimum number of cross product operations that must be used is
    1. A.

      1

    2. B.

      2

    3. C.

      3

    4. D.

      4

    Question 6 · Databases · 2024_Set1 NAT
    Consider the following two relations, and :

    R A B 10 20 20 30 30 40 30 50 50 95 S A C 10 90 30 45 40 80
    The total number of tuples obtained by evaluating the following expression is __________
    Question 7 · Databases · 2022 NAT
    Consider the relational database with the following four schemas and their respective instances.

    Student(sNo, sName, dNo)  Dept(dNo, dName)

    Course(cNo, cName, dNo)  Register(sNo, cNo)


    Student
    sNosNamedNo
    S01JamesD01
    S02RockyD01
    S03JacksonD02
    S04JaneD01
    S05MilliD02

    Dept
    dNodName
    D01CSE
    D02EEE

    Course
    cNocNamedNo
    C11DSD01
    C12OSD01
    C21DED02
    C22PTD02
    C23CVD03

    Register
    sNocNo
    S01C11
    S01C12
    S02C11
    S03C21
    S03C22
    S03C23
    S04C11
    S04C12
    S05C11
    S05C21


    SQL Query:

    SELECT * FROM Student AS S WHERE NOT EXIST
      (SELECT cNo FROM Course WHERE dNo = “D01”
            EXCEPT
       SELECT cNo FROM Register WHERE sNo = S.sNo)


    The number of rows returned by the above SQL query is___________.
    Question 8 · Databases · 2022 MSQ
    Consider the following three relations in a relational database.



    Which of the following relational algebra expressions return the set of who own all the brands?
    1. A.

    2. B.

    3. C.

    4. D.

    Question 9 · Databases · 2021_Set2 MCQ
    The relation scheme given below is used to store information about the employees of a company, where empId is the key and deptId indicates the department to which the employee is assigned. Each employee is assigned to exactly one department.

    emp(empId, name, gender, salary, deptId)

    Consider the following SQL query:

    select deptId, count(*)
    from emp
    where gender = "female" and salary > (select avg(salary) from emp)
    group by deptId;

    The above query gives, for each department in the company, the number of female employees whose salary is greater than the average salary of
    1. A.

      employees in the department.

    2. B.

      employees in the company.

    3. C.

      female employees in the department.

    4. D.

      female employees in the company.

    Question 10 · Databases · 2021_Set1 MCQ
    The following relation records the age of 500 employees of a company, where empNo (indicating the employee number) is the key:


    Consider the following relational algebra expression:


    What does the above expression generate?
    1. A.

      Employee numbers of only those employees whose age is the maximum.

    2. B.

      Employee numbers of only those employees whose age is more than the age of exactly one other employee.

    3. C.

      Employee numbers of all employees whose age is not the minimum.

    4. D.

      Employee numbers of all employees whose age is the minimum.

    More previous year questions (pyqs) in this unit