I am trying to run the below SQL query to rank employees as per their salary. The code is as below
select id, name, salary, departmentid, dense_rank() over (partition by department id order by salary desc) as rank from employee
but I am receiving the following error and I don’t think there is any issue with the code.
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ‘id order by salary desc) as rank from employee’ at line 1