Case 2: org chart and headcount

Who reports to whom, how many posts does each department have, and when does probation end for the new hires? Three questions every HR team answers regularly.

In short: the Employees table goes into the query twice, as e (employee) and m (manager), joined on e.ManagerID = m.EmployeeID. FTE is Sum([WeeklyHours])/40 with the total Expression. DateAdd("m",6,[HireDate]) calculates the end of probation.

Task 1: who reports to whom

Task Who reports to whom? Show FirstName, LastName and Manager (the manager's last name) of all active employees, sorted by LastName and FirstName. The managing director has no manager and appears with an empty cell.

Employees 40 rows, 10 columns
EmployeeIDEmployeeNoFirstNameLastNameDepartmentIDManagerIDHireDateTermDateWeeklyHoursLeaveDays
1E1001EllaHill123 Dec 20134025
2E1002OliviaTaylor2110 Sep 20134025
3E1003GraceWright3122 Nov 20104025
4E1004LiamWright413 Mar 20154025
5E1005AvaWilson519 Sep 20144025
6E1006DavidWilson5513 Dec 20132013
7E1007LiamEvans444 May 20124025
8E1008NinaClark5516 Jun 202411 Mar 20264025
9E1009LeoClark5512 Mar 20154025
10E1010SophiaJohnson4429 Nov 20254025
11E1011LiamTaylor228 Sep 20194025
12E1012ChloeDavies2214 Jun 20204025
13E1013HenrySmith222 Feb 20204025
14E1014MiaBaker554 Apr 20194025
15E1015JackYoung444 Mar 20174025
16E1016MiaWard554 Nov 20174025
17E1017LucasBrown2217 Jan 20163220
18E1018GraceTaylor4422 Jan 20194025
19E1019GraceKing3311 Sep 201630 Dec 20254025
20E1020MiaJohnson3321 Sep 20203220
21E1021NoahBrown3328 Jul 20154025
22E1022OliviaHill339 Sep 20102013
23E1023SamTaylor334 Jun 20224025
24E1024LiamKing558 Aug 20214025
25E1025OliverWard448 Dec 20134025
26E1026ChloeJohnson4418 Oct 20134025
27E1027EllaDavies3321 Nov 20114025
28E1028JackTaylor5510 May 20103220
29E1029OliverBrown2212 Jun 20123019
30E1030NoahHall4424 Jul 20214025
31E1031JackWalker5527 Mar 201427 Dec 20253019
32E1032GraceBaker557 Dec 20222013
33E1033OliverDavies446 Aug 20124025
34E1034SamDavies5511 May 20264025
35E1035EmmaDavies4420 Oct 20253019
36E1036MiaWright5516 May 20214025
37E1037LeoJohnson4421 Jun 20264025
38E1038DavidHughes558 Dec 20254025
39E1039EmmaWright443 Jul 20263220
40E1040ChloeWard333 Apr 20253220

The lesson on SQL view shows table aliases.

Task 2: headcount and FTE

Task Headcount and FTE per department: show Department, the number of active employees (count EmployeeID from Employees) and FTE, the sum of weekly hours divided by 40, sorted by Department.

Departments 5 rows, 3 columns
DepartmentIDDepartmentCostCenter
1Management100
2Sales200
3Warehouse300
4Administration400
5IT500
Employees 40 rows, 10 columns
EmployeeIDEmployeeNoFirstNameLastNameDepartmentIDManagerIDHireDateTermDateWeeklyHoursLeaveDays
1E1001EllaHill123 Dec 20134025
2E1002OliviaTaylor2110 Sep 20134025
3E1003GraceWright3122 Nov 20104025
4E1004LiamWright413 Mar 20154025
5E1005AvaWilson519 Sep 20144025
6E1006DavidWilson5513 Dec 20132013
7E1007LiamEvans444 May 20124025
8E1008NinaClark5516 Jun 202411 Mar 20264025
9E1009LeoClark5512 Mar 20154025
10E1010SophiaJohnson4429 Nov 20254025
11E1011LiamTaylor228 Sep 20194025
12E1012ChloeDavies2214 Jun 20204025
13E1013HenrySmith222 Feb 20204025
14E1014MiaBaker554 Apr 20194025
15E1015JackYoung444 Mar 20174025
16E1016MiaWard554 Nov 20174025
17E1017LucasBrown2217 Jan 20163220
18E1018GraceTaylor4422 Jan 20194025
19E1019GraceKing3311 Sep 201630 Dec 20254025
20E1020MiaJohnson3321 Sep 20203220
21E1021NoahBrown3328 Jul 20154025
22E1022OliviaHill339 Sep 20102013
23E1023SamTaylor334 Jun 20224025
24E1024LiamKing558 Aug 20214025
25E1025OliverWard448 Dec 20134025
26E1026ChloeJohnson4418 Oct 20134025
27E1027EllaDavies3321 Nov 20114025
28E1028JackTaylor5510 May 20103220
29E1029OliverBrown2212 Jun 20123019
30E1030NoahHall4424 Jul 20214025
31E1031JackWalker5527 Mar 201427 Dec 20253019
32E1032GraceBaker557 Dec 20222013
33E1033OliverDavies446 Aug 20124025
34E1034SamDavies5511 May 20264025
35E1035EmmaDavies4420 Oct 20253019
36E1036MiaWright5516 May 20214025
37E1037LeoJohnson4421 Jun 20264025
38E1038DavidHughes558 Dec 20254025
39E1039EmmaWright443 Jul 20263220
40E1040ChloeWard333 Apr 20253220

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

The first exercise in this lesson is free.

The total Expression adds to the lesson on totals queries.

Task 3: end of probation

Task When does probation end for the 2026 hires? Show FirstName, LastName, HireDate and ProbationEnd (HireDate plus 6 months) of all employees hired on or after 1 Jan 2026, the earliest end first.

Employees 40 rows, 10 columns
EmployeeIDEmployeeNoFirstNameLastNameDepartmentIDManagerIDHireDateTermDateWeeklyHoursLeaveDays
1E1001EllaHill123 Dec 20134025
2E1002OliviaTaylor2110 Sep 20134025
3E1003GraceWright3122 Nov 20104025
4E1004LiamWright413 Mar 20154025
5E1005AvaWilson519 Sep 20144025
6E1006DavidWilson5513 Dec 20132013
7E1007LiamEvans444 May 20124025
8E1008NinaClark5516 Jun 202411 Mar 20264025
9E1009LeoClark5512 Mar 20154025
10E1010SophiaJohnson4429 Nov 20254025
11E1011LiamTaylor228 Sep 20194025
12E1012ChloeDavies2214 Jun 20204025
13E1013HenrySmith222 Feb 20204025
14E1014MiaBaker554 Apr 20194025
15E1015JackYoung444 Mar 20174025
16E1016MiaWard554 Nov 20174025
17E1017LucasBrown2217 Jan 20163220
18E1018GraceTaylor4422 Jan 20194025
19E1019GraceKing3311 Sep 201630 Dec 20254025
20E1020MiaJohnson3321 Sep 20203220
21E1021NoahBrown3328 Jul 20154025
22E1022OliviaHill339 Sep 20102013
23E1023SamTaylor334 Jun 20224025
24E1024LiamKing558 Aug 20214025
25E1025OliverWard448 Dec 20134025
26E1026ChloeJohnson4418 Oct 20134025
27E1027EllaDavies3321 Nov 20114025
28E1028JackTaylor5510 May 20103220
29E1029OliverBrown2212 Jun 20123019
30E1030NoahHall4424 Jul 20214025
31E1031JackWalker5527 Mar 201427 Dec 20253019
32E1032GraceBaker557 Dec 20222013
33E1033OliverDavies446 Aug 20124025
34E1034SamDavies5511 May 20264025
35E1035EmmaDavies4420 Oct 20253019
36E1036MiaWright5516 May 20214025
37E1037LeoJohnson4421 Jun 20264025
38E1038DavidHughes558 Dec 20254025
39E1039EmmaWright443 Jul 20263220
40E1040ChloeWard333 Apr 20253220

This exercise is part of Premium.

Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.

See Premium Already Premium? Log in

The first exercise in this lesson is free.

The lesson on date criteria shows date functions.

Common mistakes

INNER JOIN in the self join

The managing director has no ManagerID. With an INNER JOIN they are missing from the org chart, of all people the top.

180 days instead of 6 months

[HireDate]+180 lands a few days off the end of probation depending on the months. Contracts count in months, and so does DateAdd("m",6,…).

In real Access

  • A real org chart over several levels is built with a report grouped by manager, or with a query that joins the table three or four times.
  • The full-time basis of 40 hours is fixed here. If the company has different standard hours, keep them in a settings table.
  • The length of probation is in the employment contract. With a ProbationMonths field per person, the 6 becomes a field reference.

How to check your result

  • Task 1: 37 active employees; the managing director Ella Hill appears with an empty Manager cell.
  • Task 2: Administration 12 heads and 11.55 FTE, IT 11 and 9.8, Management 1 and 1, plus Sales and Warehouse.
  • Task 3: three hires in 2026; Emma Wright (hired 3 Jul 2026) finishes probation on 3 Jan 2027.

Next: case 3, Training records

Last record per mandatory training, refreshers due and missing trainings.

Go to case 3

Back to the course overview.

Write to us

Choose language

Select your preferred language