Create a query to display the total number of employees and, of that total, the number of
employees hired in 1995, 1996, 1997, and 1998. Create appropriate column headings.
假设员工表有以下字段
firstname varchar
hire_date date 等
答案 0 :(得分:1)
SELECT COUNT(*) "Total",
SUM(DECODE(hire_date,'2010',1,0)) "2010 Count" ,
SUM(DECODE(hire_date,'2015',1,0)) "2015 Count",
SUM(DECODE(hire_date,'2014',1,0)) "2014 Count"
FROM emp;