Find Lowest Salary Per Employee Department

Find the employee with the lowest salary in each department.

sql

SELECT department_id, name, salary FROM employees e1 WHERE salary = ( SELECT MIN(salary) FROM employees e2 WHERE e1.department_id = e2.department_id );

This query uses a correlated subquery to identify the minimum salary within each department and returns the corresponding employee records.

PromptDB can make mistakes. Please double-check responses.