GATE DA 2026 — Question 51

Database Management and Warehousingrelational model: relational algebra, tuple calculus, SQLMSQ2 marksMedium

Consider a table Employee(EmpID, TeamID), where the column EmpID (ID of an employee) is the primary key. The column TeamID denotes the team ID of the team of which the employee is a member. TeamID is a NOT NULL column. We want to display the size of the team (denoted as TeamSize) in which each employee is a member by using SQL. As an example, the desired output for the given Employee table is also shown in tabular form. Which of the following is/are correct?
Question image
  1. A
    sql
    1SELECT E.EmpID, B.TeamSize
    2FROM Employee AS E, (SELECT TeamID, COUNT(TeamID) AS
    3TeamSize FROM Employee GROUP BY TeamID) AS B
    4WHERE E.TeamID = B.TeamID
    5
  2. B
    sql
    1SELECT A.EmpID, COUNT(B.TeamID) AS TeamSize
    2FROM Employee AS A, Employee AS B
    3WHERE A.TeamID = B.TeamID AND A.EmpID = B.EmpID
    4GROUP BY A.EmpID
    5
  3. C
    sql
    1SELECT B.EmpID, B.TeamSize
    2FROM (SELECT EmpID, COUNT(TeamID) AS TeamSize
    3FROM Employee GROUP BY EmpID) AS B
    4
  4. D
    sql
    1SELECT A.EmpID, B.TeamSize
    2FROM Employee AS A, (SELECT COUNT(TeamID) AS TeamSize FROM
    3Employee GROUP BY TeamID) AS B
    4WHERE A.TeamID = B.TeamID
    5
Practise the full 2026 paper
Challenge a friend: WhatsApp Telegram
From RENYXERAPractise this subject in the exam simulatorTimed, GATE-style tests with analytics that find your weak topics.
Practise more on relational model: relational algebra, tuple calculus, SQLTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group