title: I need to fetch the second highest salary per department using correlated subquery and oracle sql
body: <p>if I run the code like that I get the result I need, but I also need to add the name column, and once I add it, the result changes</p>
  <pre><code>select  department_id, max(salary)
  from employees e1
  where salary &lt; 
  (select max(salary) 
  from employees e2
  where e2.department_id=e1.department_id)
  group by department_id
  order by department_id;
  </code></pre>