I have managed to find a solution for the problem. If anyone has a more optimal solution, he/she is welcome post it! My query is:
Code:
/* 4. */
SELECT first_name, last_name
FROM employees
JOIN dept_emp ON dept_emp.emp_no=employees.emp_no
WHERE dept_no=(
SELECT max_emps_tbl.dept_no
FROM (
/* 3. */
SELECT departments.dept_no, COUNT(*) AS nr
FROM departments
JOIN dept_emp ON departments.dept_no=dept_emp.dept_no
GROUP BY dept_no
HAVING nr=(
/* 2. retrieves the maximum value of the nr_of_emps column */
SELECT MAX(dept_emp_summary.nr_of_emps) AS max_emps
FROM (
/* 1.: creates a summary of departments and the number of employees*/
SELECT departments.dept_no, COUNT(*) AS nr_of_emps
FROM departments
JOIN dept_emp ON departments.dept_no=dept_emp.dept_no
GROUP BY dept_no)
AS dept_emp_summary))
AS max_emps_tbl
)