Find the Maximum Average

You have a table Janitor that has the following structure.

Janitor_id NOT NULL NUMBER(6)
first_name VARCHAR2(20)
last_name NOT NULL VARCHAR2(25)
email NOT NULL VARCHAR2(25)
phone_number VARCHAR2(20)
hire_date NOT NULL DATE
Job_id NOT NULL VARCHAR2(10)
salary NUMBER(8,2)
Manager_id NUMBER(6)

Which of the following query will you use to find the Job_id that has a maximum average salary?

Options
1.SELECT job_id, avg(salary)
FROM employees
HAVING max(avg(salary) in (SELECT 
max(avg(salary) 
FROM employees 
GROUP BY job_id);
2.SELECT job_id, avg(salary)
FROM employees
GROUP BY job_id
HAVING max(avg(salary) in (SELECT max(avg(salary) FROM employees);
3.SELECT job_id, avg(salary)
FROM employees
GROUP BY job_id
HAVING avg(salary) in (SELECT max(avg(salary) 
FROM employees 
GROUP BY job_id);
4.None of these

Related Posts

Close Bitnami banner
Bitnami