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
| EmployeeID | EmployeeNo | FirstName | LastName | DepartmentID | ManagerID | HireDate | TermDate | WeeklyHours | LeaveDays |
|---|---|---|---|---|---|---|---|---|---|
| 1 | E1001 | Ella | Hill | 1 | 23 Dec 2013 | 40 | 25 | ||
| 2 | E1002 | Olivia | Taylor | 2 | 1 | 10 Sep 2013 | 40 | 25 | |
| 3 | E1003 | Grace | Wright | 3 | 1 | 22 Nov 2010 | 40 | 25 | |
| 4 | E1004 | Liam | Wright | 4 | 1 | 3 Mar 2015 | 40 | 25 | |
| 5 | E1005 | Ava | Wilson | 5 | 1 | 9 Sep 2014 | 40 | 25 | |
| 6 | E1006 | David | Wilson | 5 | 5 | 13 Dec 2013 | 20 | 13 | |
| 7 | E1007 | Liam | Evans | 4 | 4 | 4 May 2012 | 40 | 25 | |
| 8 | E1008 | Nina | Clark | 5 | 5 | 16 Jun 2024 | 11 Mar 2026 | 40 | 25 |
| 9 | E1009 | Leo | Clark | 5 | 5 | 12 Mar 2015 | 40 | 25 | |
| 10 | E1010 | Sophia | Johnson | 4 | 4 | 29 Nov 2025 | 40 | 25 | |
| 11 | E1011 | Liam | Taylor | 2 | 2 | 8 Sep 2019 | 40 | 25 | |
| 12 | E1012 | Chloe | Davies | 2 | 2 | 14 Jun 2020 | 40 | 25 | |
| 13 | E1013 | Henry | Smith | 2 | 2 | 2 Feb 2020 | 40 | 25 | |
| 14 | E1014 | Mia | Baker | 5 | 5 | 4 Apr 2019 | 40 | 25 | |
| 15 | E1015 | Jack | Young | 4 | 4 | 4 Mar 2017 | 40 | 25 | |
| 16 | E1016 | Mia | Ward | 5 | 5 | 4 Nov 2017 | 40 | 25 | |
| 17 | E1017 | Lucas | Brown | 2 | 2 | 17 Jan 2016 | 32 | 20 | |
| 18 | E1018 | Grace | Taylor | 4 | 4 | 22 Jan 2019 | 40 | 25 | |
| 19 | E1019 | Grace | King | 3 | 3 | 11 Sep 2016 | 30 Dec 2025 | 40 | 25 |
| 20 | E1020 | Mia | Johnson | 3 | 3 | 21 Sep 2020 | 32 | 20 | |
| 21 | E1021 | Noah | Brown | 3 | 3 | 28 Jul 2015 | 40 | 25 | |
| 22 | E1022 | Olivia | Hill | 3 | 3 | 9 Sep 2010 | 20 | 13 | |
| 23 | E1023 | Sam | Taylor | 3 | 3 | 4 Jun 2022 | 40 | 25 | |
| 24 | E1024 | Liam | King | 5 | 5 | 8 Aug 2021 | 40 | 25 | |
| 25 | E1025 | Oliver | Ward | 4 | 4 | 8 Dec 2013 | 40 | 25 | |
| 26 | E1026 | Chloe | Johnson | 4 | 4 | 18 Oct 2013 | 40 | 25 | |
| 27 | E1027 | Ella | Davies | 3 | 3 | 21 Nov 2011 | 40 | 25 | |
| 28 | E1028 | Jack | Taylor | 5 | 5 | 10 May 2010 | 32 | 20 | |
| 29 | E1029 | Oliver | Brown | 2 | 2 | 12 Jun 2012 | 30 | 19 | |
| 30 | E1030 | Noah | Hall | 4 | 4 | 24 Jul 2021 | 40 | 25 | |
| 31 | E1031 | Jack | Walker | 5 | 5 | 27 Mar 2014 | 27 Dec 2025 | 30 | 19 |
| 32 | E1032 | Grace | Baker | 5 | 5 | 7 Dec 2022 | 20 | 13 | |
| 33 | E1033 | Oliver | Davies | 4 | 4 | 6 Aug 2012 | 40 | 25 | |
| 34 | E1034 | Sam | Davies | 5 | 5 | 11 May 2026 | 40 | 25 | |
| 35 | E1035 | Emma | Davies | 4 | 4 | 20 Oct 2025 | 30 | 19 | |
| 36 | E1036 | Mia | Wright | 5 | 5 | 16 May 2021 | 40 | 25 | |
| 37 | E1037 | Leo | Johnson | 4 | 4 | 21 Jun 2026 | 40 | 25 | |
| 38 | E1038 | David | Hughes | 5 | 5 | 8 Dec 2025 | 40 | 25 | |
| 39 | E1039 | Emma | Wright | 4 | 4 | 3 Jul 2026 | 32 | 20 | |
| 40 | E1040 | Chloe | Ward | 3 | 3 | 3 Apr 2025 | 32 | 20 |
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
| DepartmentID | Department | CostCenter |
|---|---|---|
| 1 | Management | 100 |
| 2 | Sales | 200 |
| 3 | Warehouse | 300 |
| 4 | Administration | 400 |
| 5 | IT | 500 |
Employees 40 rows, 10 columns
| EmployeeID | EmployeeNo | FirstName | LastName | DepartmentID | ManagerID | HireDate | TermDate | WeeklyHours | LeaveDays |
|---|---|---|---|---|---|---|---|---|---|
| 1 | E1001 | Ella | Hill | 1 | 23 Dec 2013 | 40 | 25 | ||
| 2 | E1002 | Olivia | Taylor | 2 | 1 | 10 Sep 2013 | 40 | 25 | |
| 3 | E1003 | Grace | Wright | 3 | 1 | 22 Nov 2010 | 40 | 25 | |
| 4 | E1004 | Liam | Wright | 4 | 1 | 3 Mar 2015 | 40 | 25 | |
| 5 | E1005 | Ava | Wilson | 5 | 1 | 9 Sep 2014 | 40 | 25 | |
| 6 | E1006 | David | Wilson | 5 | 5 | 13 Dec 2013 | 20 | 13 | |
| 7 | E1007 | Liam | Evans | 4 | 4 | 4 May 2012 | 40 | 25 | |
| 8 | E1008 | Nina | Clark | 5 | 5 | 16 Jun 2024 | 11 Mar 2026 | 40 | 25 |
| 9 | E1009 | Leo | Clark | 5 | 5 | 12 Mar 2015 | 40 | 25 | |
| 10 | E1010 | Sophia | Johnson | 4 | 4 | 29 Nov 2025 | 40 | 25 | |
| 11 | E1011 | Liam | Taylor | 2 | 2 | 8 Sep 2019 | 40 | 25 | |
| 12 | E1012 | Chloe | Davies | 2 | 2 | 14 Jun 2020 | 40 | 25 | |
| 13 | E1013 | Henry | Smith | 2 | 2 | 2 Feb 2020 | 40 | 25 | |
| 14 | E1014 | Mia | Baker | 5 | 5 | 4 Apr 2019 | 40 | 25 | |
| 15 | E1015 | Jack | Young | 4 | 4 | 4 Mar 2017 | 40 | 25 | |
| 16 | E1016 | Mia | Ward | 5 | 5 | 4 Nov 2017 | 40 | 25 | |
| 17 | E1017 | Lucas | Brown | 2 | 2 | 17 Jan 2016 | 32 | 20 | |
| 18 | E1018 | Grace | Taylor | 4 | 4 | 22 Jan 2019 | 40 | 25 | |
| 19 | E1019 | Grace | King | 3 | 3 | 11 Sep 2016 | 30 Dec 2025 | 40 | 25 |
| 20 | E1020 | Mia | Johnson | 3 | 3 | 21 Sep 2020 | 32 | 20 | |
| 21 | E1021 | Noah | Brown | 3 | 3 | 28 Jul 2015 | 40 | 25 | |
| 22 | E1022 | Olivia | Hill | 3 | 3 | 9 Sep 2010 | 20 | 13 | |
| 23 | E1023 | Sam | Taylor | 3 | 3 | 4 Jun 2022 | 40 | 25 | |
| 24 | E1024 | Liam | King | 5 | 5 | 8 Aug 2021 | 40 | 25 | |
| 25 | E1025 | Oliver | Ward | 4 | 4 | 8 Dec 2013 | 40 | 25 | |
| 26 | E1026 | Chloe | Johnson | 4 | 4 | 18 Oct 2013 | 40 | 25 | |
| 27 | E1027 | Ella | Davies | 3 | 3 | 21 Nov 2011 | 40 | 25 | |
| 28 | E1028 | Jack | Taylor | 5 | 5 | 10 May 2010 | 32 | 20 | |
| 29 | E1029 | Oliver | Brown | 2 | 2 | 12 Jun 2012 | 30 | 19 | |
| 30 | E1030 | Noah | Hall | 4 | 4 | 24 Jul 2021 | 40 | 25 | |
| 31 | E1031 | Jack | Walker | 5 | 5 | 27 Mar 2014 | 27 Dec 2025 | 30 | 19 |
| 32 | E1032 | Grace | Baker | 5 | 5 | 7 Dec 2022 | 20 | 13 | |
| 33 | E1033 | Oliver | Davies | 4 | 4 | 6 Aug 2012 | 40 | 25 | |
| 34 | E1034 | Sam | Davies | 5 | 5 | 11 May 2026 | 40 | 25 | |
| 35 | E1035 | Emma | Davies | 4 | 4 | 20 Oct 2025 | 30 | 19 | |
| 36 | E1036 | Mia | Wright | 5 | 5 | 16 May 2021 | 40 | 25 | |
| 37 | E1037 | Leo | Johnson | 4 | 4 | 21 Jun 2026 | 40 | 25 | |
| 38 | E1038 | David | Hughes | 5 | 5 | 8 Dec 2025 | 40 | 25 | |
| 39 | E1039 | Emma | Wright | 4 | 4 | 3 Jul 2026 | 32 | 20 | |
| 40 | E1040 | Chloe | Ward | 3 | 3 | 3 Apr 2025 | 32 | 20 |
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
| EmployeeID | EmployeeNo | FirstName | LastName | DepartmentID | ManagerID | HireDate | TermDate | WeeklyHours | LeaveDays |
|---|---|---|---|---|---|---|---|---|---|
| 1 | E1001 | Ella | Hill | 1 | 23 Dec 2013 | 40 | 25 | ||
| 2 | E1002 | Olivia | Taylor | 2 | 1 | 10 Sep 2013 | 40 | 25 | |
| 3 | E1003 | Grace | Wright | 3 | 1 | 22 Nov 2010 | 40 | 25 | |
| 4 | E1004 | Liam | Wright | 4 | 1 | 3 Mar 2015 | 40 | 25 | |
| 5 | E1005 | Ava | Wilson | 5 | 1 | 9 Sep 2014 | 40 | 25 | |
| 6 | E1006 | David | Wilson | 5 | 5 | 13 Dec 2013 | 20 | 13 | |
| 7 | E1007 | Liam | Evans | 4 | 4 | 4 May 2012 | 40 | 25 | |
| 8 | E1008 | Nina | Clark | 5 | 5 | 16 Jun 2024 | 11 Mar 2026 | 40 | 25 |
| 9 | E1009 | Leo | Clark | 5 | 5 | 12 Mar 2015 | 40 | 25 | |
| 10 | E1010 | Sophia | Johnson | 4 | 4 | 29 Nov 2025 | 40 | 25 | |
| 11 | E1011 | Liam | Taylor | 2 | 2 | 8 Sep 2019 | 40 | 25 | |
| 12 | E1012 | Chloe | Davies | 2 | 2 | 14 Jun 2020 | 40 | 25 | |
| 13 | E1013 | Henry | Smith | 2 | 2 | 2 Feb 2020 | 40 | 25 | |
| 14 | E1014 | Mia | Baker | 5 | 5 | 4 Apr 2019 | 40 | 25 | |
| 15 | E1015 | Jack | Young | 4 | 4 | 4 Mar 2017 | 40 | 25 | |
| 16 | E1016 | Mia | Ward | 5 | 5 | 4 Nov 2017 | 40 | 25 | |
| 17 | E1017 | Lucas | Brown | 2 | 2 | 17 Jan 2016 | 32 | 20 | |
| 18 | E1018 | Grace | Taylor | 4 | 4 | 22 Jan 2019 | 40 | 25 | |
| 19 | E1019 | Grace | King | 3 | 3 | 11 Sep 2016 | 30 Dec 2025 | 40 | 25 |
| 20 | E1020 | Mia | Johnson | 3 | 3 | 21 Sep 2020 | 32 | 20 | |
| 21 | E1021 | Noah | Brown | 3 | 3 | 28 Jul 2015 | 40 | 25 | |
| 22 | E1022 | Olivia | Hill | 3 | 3 | 9 Sep 2010 | 20 | 13 | |
| 23 | E1023 | Sam | Taylor | 3 | 3 | 4 Jun 2022 | 40 | 25 | |
| 24 | E1024 | Liam | King | 5 | 5 | 8 Aug 2021 | 40 | 25 | |
| 25 | E1025 | Oliver | Ward | 4 | 4 | 8 Dec 2013 | 40 | 25 | |
| 26 | E1026 | Chloe | Johnson | 4 | 4 | 18 Oct 2013 | 40 | 25 | |
| 27 | E1027 | Ella | Davies | 3 | 3 | 21 Nov 2011 | 40 | 25 | |
| 28 | E1028 | Jack | Taylor | 5 | 5 | 10 May 2010 | 32 | 20 | |
| 29 | E1029 | Oliver | Brown | 2 | 2 | 12 Jun 2012 | 30 | 19 | |
| 30 | E1030 | Noah | Hall | 4 | 4 | 24 Jul 2021 | 40 | 25 | |
| 31 | E1031 | Jack | Walker | 5 | 5 | 27 Mar 2014 | 27 Dec 2025 | 30 | 19 |
| 32 | E1032 | Grace | Baker | 5 | 5 | 7 Dec 2022 | 20 | 13 | |
| 33 | E1033 | Oliver | Davies | 4 | 4 | 6 Aug 2012 | 40 | 25 | |
| 34 | E1034 | Sam | Davies | 5 | 5 | 11 May 2026 | 40 | 25 | |
| 35 | E1035 | Emma | Davies | 4 | 4 | 20 Oct 2025 | 30 | 19 | |
| 36 | E1036 | Mia | Wright | 5 | 5 | 16 May 2021 | 40 | 25 | |
| 37 | E1037 | Leo | Johnson | 4 | 4 | 21 Jun 2026 | 40 | 25 | |
| 38 | E1038 | David | Hughes | 5 | 5 | 8 Dec 2025 | 40 | 25 | |
| 39 | E1039 | Emma | Wright | 4 | 4 | 3 Jul 2026 | 32 | 20 | |
| 40 | E1040 | Chloe | Ward | 3 | 3 | 3 Apr 2025 | 32 | 20 |
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.
Back to the course overview.