row_number() is non diterministic.
947771Mar 1 2013 — edited Mar 7 2013hi,
empid frist name sal DEPARTMENT_ID
123 Shanta 7000 50
122 Payam 8000 50
120 Matthew 8000 50
121 Adam Fripp 8200 50
SELECT
Department_id, first_name, salary,
ROW_NUMBER() OVER (PARTITION BY department_id ORDER BY salary desc) RN_NO
FROM employees
ORDER BY department_id, salary
i read that row_number is non deterministin so i show that if it is non deterministic then also i will have
empid frist name sal DEPARTMENT_ID RN_NO
123 Shanta 7000 50 4
122 Payam 8000 50 3
120 Matthew 8000 50 2
121 Adam Fripp 8200 50 1
or this
empid frist name sal DEPARTMENT_ID RN_NO
123 Shanta 7000 50 4
122 Payam 8000 50 2
120 Matthew 8000 50 3
121 Adam Fripp 8200 50 1
that is empid 122 and 120 may get 2 or 3 but empid 121 will get 1 and 123 will get 4 RN_NO.
please correct me.
yours sincerely