Select the Query

Consider the following two tables.

Employees

employee_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)
department_id NUMBER(6)
PRIMARY KEY(employee_id) 
FOREIGN KEY(department_id) REFERENCES Department

Department

department_id NOT NULL NUMBER(6)
department_name VARCHAR2(20)
location_id NUMBER(6)
PRIMARY KEY(department_id) 

Which of these queries finds all employees whose salaries are greater than the lowest salary of every department?

Options
1.SELECT 
 employee_id, first_name, last_name, salary
FROM
 employees
WHERE
 salary >= ALL (SELECT 
 MIN(salary)
 FROM
 employees
 GROUP BY department_id)
ORDER BY first_name , last_name;
2.SELECT 
 employee_id, first_name, last_name, salary
FROM
 employees
WHERE
 salary >= SOME (SELECT 
 MAX(salary)
 FROM
 employees
 GROUP BY department_id);

3.SELECT 
 employee_id, first_name, last_name, salary
FROM
 employees
WHERE
 MAX(salary) IN (SELECT 
 MIN(salary)
 FROM
 employees
 GROUP BY department_id)
ORDER BY first_name , last_name;

4.None of these

Related Posts

Close Bitnami banner
Bitnami