The GATE Grind

GATE Databases: Relational Model: Relational Algebra, Tuple Calculus, SQL – Previous Year Questions

48 GATE previous year questions on Relational Model: Relational Algebra, Tuple Calculus, SQL (Databases, Computer Science) with answers and explanations, from every paper.

48 questions worth 82 marks in all (14 1-mark, 34 2-mark). Asked between 2007 and 2026, so you can see how the topic has been tested over time.

  1. GATE 2007 CS Q59 (2 marks, Multiple choice) – Relations studInfo(studId, name, sex), key studId, and enroll(studId, courseId), key(studId, courseId), record students and courses. Every course has…
  2. GATE 2007 CS Q60 (2 marks, Multiple choice) – employee(name, sex, supervisorName) has key name; supervisorName names an immediate supervisor. What does \e.name employee(e) x[ employee(x)…
  3. GATE 2007 CS Q61 (2 marks, Multiple choice) – employee(empId, name, department, salary) has more than one employee in department5. We want employees paid more than anyone in department5. Which is…
  4. GATE 2008 CS Q15 (1 mark, Multiple choice) – Which tuple-relational-calculus expression is equivalent to t r(P(t))? I. t r(P(t)) II. t r(P(t)) III. t r( P(t)) IV. t r( P(t))
  5. GATE 2008 CS Q68 (2 marks, Multiple choice) – Relations R(P, Q, R1, R2, R3), S(P, Q, S1, S2) both have key P, Q. Which queries are equivalent? I. P(R S) II. P(R) P(S) III. P( P,Q(R) P,Q(S)) IV. P(…
  6. GATE 2009 CS Q45 (2 marks, Multiple choice) – Let schemas R=a, b, c, S=c. Which queries are equivalent? I. R-S(r)- R-S(( R-S(r) s)- R-S,S(r)) II. \t t R-S(r) u s( v r(u=v[S] t=v[R-S]))\ III. \t t…
  7. GATE 2009 CS Q55 (2 marks, Multiple choice) – Relations: Suppliers(sid:integer, sname:string, city:string, street:string), Parts(pid:integer, pname:string, color:string), Catalog(sid:integer,…
  8. GATE 2021 CS (CS2) Q41 (2 marks, Multiple choice) – emp(empId,name,gender,salary,deptId) has key empId, and each employee belongs to one department. What does this query count for each department? It…
  9. GATE 2015 CS (CS3) Q29 (1 mark, Multiple choice) – Cinema(theater,address,capacity) stores theaters. Complete the query to always return addresses of maximum-capacity theaters, assuming non-NULL…
  10. GATE 2015 CS (CS2) Q40 (2 marks, Multiple choice) – R1(A,B)=(1,5),(3,7) and R2(A,C)=(1,7),(4,9). Let R be their full natural outer join. Candidate tuples are a=(1,5,NULL), b=(1,NULL,7), c=(3,NULL,9),…
  11. GATE 2010 CS Q29 (1 mark, Multiple choice) – Passenger(pid,pname,age) has (0,Sachin,65),(1,Rahul,66),(2,Sourav,67),(3,Anil,69). Reservation(pid,class,tid) has…
  12. GATE 2010 CS Q53 (2 marks, Multiple choice) – Relations R(A,B,C) and S(B,D,E) satisfy B→A and A→C. R has 200 tuples and S has 100. What is the maximum tuple count in R natural-join S?
  13. GATE 2011 CS Q42 (2 marks, Multiple choice) – An integer table T(X,Y) initially contains (1,1). Let MX,MY be current maxima of its columns. Insert (MX+1,2MY+1), recomputing maxima each time, 128…
  14. GATE 2011 CS Q56 (2 marks, Multiple choice) – Loan Records(Borrower,Bank Manager,Loan Amount) contains (Ramesh,Sunderajan,10000),(Suresh,Ramgopal,5000),(Mahesh,Sunderajan,7000). Find the output.
  15. GATE 2013 CS Q45 (2 marks, Multiple choice) – Schemas: Students(rollno,sname), Courses(courseno,cname), Registration(rollno,courseno,percent). Which queries give distinct student names scoring >90…
  16. GATE 2012 CS Q25 (1 mark, Multiple choice) – Which SQL assertions are true? P: HAVING can occur without GROUP BY. Q: HAVING requires GROUP BY. R: Every GROUP BY attribute must appear in SELECT.…
  17. GATE 2012 CS Q60 (2 marks, Multiple choice) – A(Id,Name,Age)=(12,Arun,60),(15,Shreya,24),(99,Rohit,11); B(Id,Name,Age)=(15,Shreya,24),(25,Hari,40),(98,Rohit,20),(99,Rohit,11);…
  18. GATE 2012 CS Q61 (2 marks, Multiple choice) – A(Id,Name,Age)=(12,Arun,60),(15,Shreya,24),(99,Rohit,11); B(Id,Name,Age)=(15,Shreya,24),(25,Hari,40),(98,Rohit,20),(99,Rohit,11);…
  19. GATE 2017 CS (CS2) Q56 (2 marks, Numerical answer) – top scorer(player,country,goals) contains Klose/Germany/16, Ronaldo/Brazil/15, G Müller/Germany/14, Fontaine/France/13, Pelé/Brazil/12,…
  20. GATE 2016 CS (CS2) Q62 (2 marks, Numerical answer) – Table water schemes has (scheme no,district name,capacity): (1,Ajmer,20), (1,Bikaner,10), (2,Bikaner,10), (3,Bikaner,20), (1,Churu,10), (2,Churu,20),…
  21. GATE 2014 CS (CS3) Q31 (1 mark, Multiple choice) – Optimize A 1( A 2( F 1( F 2(r)))), where A 1 A 2 are attribute sets of r and F 1,F 2 are Boolean expressions on its attributes.
  22. GATE 2014 CS (CS3) Q40 (2 marks, Multiple choice) – Schemas: employee(empId,empName,empAge), dependent(depId,eId,depName,depAge). eId references empId; every employee has at least one associated…
  23. GATE 2014 CS (CS3) Q64 (2 marks, Multiple choice) – Schemas: employee(empId,empName,empDept), customer(custId,custName,salesRepId,rating). salesRepId references employee.empId. Each employee makes a…
  24. GATE 2014 CS (CS2) Q64 (2 marks, Multiple choice) – SQL allows duplicate tuples and multiplicities in joins. Which query always gives the same result as “select * from R where a in (select S.a from S)”?
  25. GATE 2014 CS (CS1) Q64 (2 marks, Multiple choice) – Schema: employees(emp-id, first-name, last-name, hire-date, dept-id, salary); departments(dept-id, dept-name, manager-id, location-id). To display…
  26. GATE 2017 CS (CS1) Q33 (1 mark, Numerical answer) – Consider a database that has the relation schema EMP (EmpId, EmpName, and DeptName). An instance of the schema EMP and a SQL query on it are given…
  27. GATE 2017 CS (CS1) Q51 (2 marks, Multiple choice) – Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId). Note that the DeptId can be permitted to be…
  28. GATE 2017 CS (CS1) Q56 (2 marks, Numerical answer) – Consider a database that has the relation schema CR(StudentName, CourseName). An instance of the schema CR is as given below. StudentName CourseName…
  29. GATE 2015 CS (CS1) Q31 (1 mark, Multiple choice) – SELECT operation in SQL is equivalent to
  30. GATE 2015 CS (CS1) Q61 (2 marks, Numerical answer) – Consider the following relations: Student Roll No Student Name --- --- 1 Raj 2 Rohit 3 Raj Performance Roll No Course Marks --- --- --- 1 Math 80 1…
  31. GATE 2018 CS Q22 (1 mark, Multiple choice) – Consider the following two tables and four queries in SQL. Book (isbn, bname), Stock (isbn, copies) Query 1: SELECT B.isbn, S.copies FROM Book B INNER…
  32. GATE 2018 CS Q51 (2 marks, Multiple choice) – Consider the relations r(A,B) and s(B,C), where s.B is a primary key and r.B is a foreign key referencing s.B. Consider the query Q:\ r( B<5(s)) Let…
  33. GATE 2019 CS Q61 (2 marks, Numerical answer) – A relational database contains two tables Student and Performance as shown below: Roll no. Student name --- --- 1 Amit 2 Priya 3 Vinit 4 Rohan 5 Smita…
  34. GATE 2019 CS Q65 (2 marks, Numerical answer) – Consider the following relations P(X,Y,Z), Q(X,Y,T) and R(Y,V). X Y Z --- --- --- X1 Y1 Z1 X1 Y1 Z2 X2 Y2 Z2 X2 Y4 Z4 (relation P) X Y T --- --- ---…
  35. GATE 2026 CS (CS1) Q30 (1 mark, Multiple select) – Let P, Q, R and S be the attributes of a relation in a relational schema. Let X Y indicate functional dependency in the context of a relational…
  36. GATE 2026 CS (CS1) Q43 (2 marks, Multiple choice) – Consider a relational database schema with two relations R(P, Q) and S(X, Y). Let E = \ u v w \, u, v R v, w S\ be a tuple relational calculus…
  37. GATE 2025 CS (CS2) Q54 (2 marks, Multiple select) – Consider the following relational schema: Students (rollno: integer, name: string, age: integer, cgpa: real) Courses (courseno: integer, cname:…
  38. GATE 2025 CS (CS1) Q39 (2 marks, Multiple choice) – Consider two relations describing teams and players in a sports league: - teams(tid, tname): tid, tname are team-id and team-name, respectively -…
  39. GATE 2025 CS (CS1) Q55 (2 marks, Numerical answer) – Consider the following database tables of a sports league. player(pid,pname,age) coach(cid,cname) team(tid,tname,city,cid) members(pid,tid) An…
  40. GATE 2024 CS (CS2) Q45 (2 marks, Multiple choice) – The relation schema, Person(pid, city), describes the city of residence for every person uniquely identified by pid. The following relational algebra…
  41. GATE 2024 CS (CS1) Q35 (1 mark, Numerical answer) – Consider two relations R(A,B) with tuples (10,20),(20,30),(30,40),(30,50),(50,95) and S(A,C) with tuples (10,90),(30,45),(40,80). The total number of…
  42. GATE 2023 CS Q16 (1 mark, Multiple choice) – Which one of the options given below refers to the degree (or arity) of a relation in relational database systems?
  43. GATE 2023 CS Q61 (2 marks, Numerical answer) – Consider the following table named Student in a relational database. The primary key of this table is rollNum. Student(rollNum, name, gender, marks):…
  44. GATE 2022 CS Q25 (1 mark, Multiple select) – Consider the following three relations in a relational database. Employee(eId, Name), Brand(bId, bName), Own(eId, bId) Which of the following…
  45. GATE 2022 CS Q56 (2 marks, Numerical answer) – Consider the relational database with the following four schemas and their respective instances. Student(sNo, sName, dNo): (S01, James, D01), (S02,…
  46. GATE 2021 CS (CS1) Q33 (1 mark, Numerical answer) – A relation r(A, B) in a relational database has 1200 tuples. The attribute A has integer values ranging from 6 to 20, and the attribute B has integer…
  47. GATE 2021 CS (CS1) Q37 (2 marks, Multiple choice) – The following relation records the age of 500 employees of a company, where empNo (indicating the employee number) is the key: empAge(empNo, age).…
  48. GATE 2020 CS Q23 (1 mark, Multiple choice) – Consider a relational database containing the following schemas. Catalogue(sno, pno, cost): (S1,P1,150), (S1,P2,50), (S1,P3,100), (S2,P4,200),…