0

For HR Database,

select min(salary) from employees group by department_id;

is returning 11 rows while,

select first_name, last_name, salary, department_id
from employees
where salary in (select min(salary) from employees group by department_id);

is returning 14 rows with few duplicate department_id with different salaries

Trying to figure out employees with minimum salary in each department

Vinit Dawane
  • 1
  • 1
  • 4
  • Your query is returning all employees with a minimum salary, but it doesn't have to be for the same department they're in. So if Accounting has a minimum of 100, you'll return all the employees with salary = 100, even if they're not in Accounting. – Barmar Dec 27 '22 at 09:04

0 Answers0