DEV Community

Pranav Bakare
Pranav Bakare

Posted on

ROW_NUMBER()

ROW_NUMBER -

Always provides a unique number to each row, regardless of ties. It does not consider any rank gaps.

SELECT 
EMPLOYEE_ID, DEPARTMENT_ID, SALARY ,
ROW_NUMBER() OVER (PARTITION BY DEPARTMENT_ID Order by salary desc) 
as ROW_NUMBER_DETAILS
FROM employees1;
Enter fullscreen mode Exit fullscreen mode

Image description


Image description

Top comments (0)