Gradient LabSign up free

Home / GATE DA / 2026 / Q.51

GATE DA 2026, Q.51: Team size for every employee

DatabasesSQL grouping and joins2 marksMSQ (more than one correct)

The question

Employee(EmpID, TeamID) with EmpID primary key and TeamID NOT NULL. Rows: (1, 8), (2, 8), (3, 8), (4, 7), (5, 7), (6, 9). Desired output: (1, 3), (2, 3), (3, 3), (4, 2), (5, 2), (6, 1). Which queries produce it?

-- (A)
SELECT E.EmpID, B.TeamSize
FROM Employee AS E, (SELECT TeamID, COUNT(TeamID) AS TeamSize
  FROM Employee GROUP BY TeamID) AS B
WHERE E.TeamID = B.TeamID

Checking your access…

Source: official GATE DA 2026 question paper and answer key (IIT Guwahati). The question is lightly reworded; every number and option is kept.