Sql, Sql Queries, Big Data, Data Analytics, Data Science.
(PARTITION BY department_id, ORDER BY Salary desc) And output for desc order will be : ROW_NUMBER() OVER (PARTITION BY department_id, ORDER BY Salary desc) Did you ever get question in interview, “Write SQL query to return highest paid employees in each department” If yes, then you already solved