如何在此查询中使用Oracle group函数count和group by子句
假设Employee表有以下字段如何在此查询中使用Oracle group函数count和group by子句,oracle,Oracle,假设Employee表有以下字段 emp_id号 名瓦查尔 租用日期 等 这可能会有帮助!。根据您的需要更换一年 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. 显示您的表定义(DDL)、现有数据和S
这可能会有帮助!。根据您的需要更换一年
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.
显示您的表定义(DDL)、现有数据和SQL(如果您还有SQL)。否则我们是瞎子,帮不了你。是的,这正是我想要的。我改变了我的查询方式——选择COUNT(*)“Total”,SUM(DECODE(to_char(雇用日期,'YYYY'),'2010',1,0))“2010 COUNT”,SUM(DECODE(to_char(雇用日期,'YYYY'),'2015',1,0))“2015 COUNT和(DECODE(to_char雇用日期,'yyyyy'),'2014',1,0))“2014 COUNT来自emp;
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;