jdbc问题,求教答案和原因

(
EMP_ID NUMBER(4) NOT NULL
LAST_NAME VARCHAR2(30) NOT NULL
FIRST_NAME VARCHAR2(30)
DEPT_ID NUMBER(2)
JOB_CAT VARCHAR2(30)
SALARY NUMBER(8,2)
)

which statement shows the maximum salary paid in each job category of each department?_______
  a. select dept_id, job_cat,max(salary) from employees where salary > max(salary);
  b. select dept_id, job_cat,max(salary) from employees group by dept_id,job_cat;
  c. select dept_id, job_cat,max(salary) from employees;
  d. select dept_id, job_cat,max(salary) from employees group by dept_id;
  e. select dept_id, job_cat,max(salary) from employees group by dept_id,job_cat,salary;

b.


这行文字是为了凑十个字符

each job category of each department,显示就是按department,category分组。maximum salary 就是max(salary)。所以选b

选B
我也要凑是个字符么?

正确答案:B

max为聚合函数,需要按照什么分组来做聚合,所以需要把查询的其他项在group by中写出来。

这行文字是为了凑十个字符