这人查询该怎么写啊?
Employees 表的结构如下:
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)
1.编写一个语句,只有当最低工资少于 5000 而且最高工资超过 1500时,
才显示部门 ID 以及该部门支付的最低工资和最高工资
2.编写一个语句,显示各部门的每个工作类别中支付的最高工资
------解决方案--------------------1.--select dept_id,max(salary),min(salary) from employees where salary between 1500 and 5000 group by dept_id;
2.--select max(salary) job_cat from employees group by job_cat;
------解决方案--------------------2是对的
1
select dept_id,max(salary),min(salary) from employees
group by dept_id
having max(salary)> 1500 and min(salary) <5000;