GATE DA 2026, Q.51: Team size for every employee
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
- (A) Join Employee E with (SELECT TeamID, COUNT(TeamID) AS TeamSize FROM Employee GROUP BY TeamID) B on E.TeamID = B.TeamID
- (B) Self-join A, B on A.TeamID = B.TeamID AND A.EmpID = B.EmpID, GROUP BY A.EmpID, COUNT(B.TeamID)
- (C) SELECT EmpID, COUNT(TeamID) FROM Employee GROUP BY EmpID
- (D) Join Employee A with (SELECT COUNT(TeamID) AS TeamSize FROM Employee GROUP BY TeamID) B on A.TeamID = B.TeamID
Checking your access…
The answer and full solution are in the GATE DA past-paper pack. All 195 questions from 2024, 2025 and 2026, each solved step by step and checked against the official key. ₹499, lifetime access.
What's in the pack · 60 questions are free to try.
Unlock this solution and every other question. ₹499, one payment, lifetime access.
Could not load the solution. Refresh the page, or email hello@gradientlab.dev.
Source: official GATE DA 2026 question paper and answer key (IIT Guwahati). The question is lightly reworded; every number and option is kept.