我正在阅读带有问题和预期输出的练习工作表。最后一个问题对我来说很难理解。任何人都可以帮忙吗?
问题
创建一个查询以显示员工总数以及 2005 年、2006 年、2007 年和 2008 年雇用的员工总数。
预期的输出格式
Total 2005 2006 2007 2008
107 29 24 19 11
以下是我尝试通过单独的查询获得结果
TO_CHAR(hire_date,'YYYY')
SELECT COUNT(employee_id) AS "Total"
FROM employees;
SELECT COUNT(employee_id) AS "2005"
FROM employees
WHERE TO_CHAR(hire_date,'YYYY') LIKE '2005' GROUP BY TO_CHAR(hire_date,'YYYY') ;
SELECT COUNT(employee_id) AS "2006"
FROM employees
WHERE TO_CHAR(hire_date,'YYYY') LIKE '2006' GROUP BY TO_CHAR(hire_date,'YYYY') ;
SELECT COUNT(employee_id) AS "2007"
FROM employees
WHERE TO_CHAR(hire_date,'YYYY') LIKE '2007' GROUP BY TO_CHAR(hire_date,'YYYY') ;
SELECT COUNT(employee_id) AS "2008"
FROM employees
WHERE TO_CHAR(hire_date,'YYYY') LIKE '2008' GROUP BY TO_CHAR(hire_date,'YYYY') ;
非常感谢任何将结果作为一个查询产生的帮助。