I am curious to know that in the following query, do I need to use order by clause in outer query or not?
SELECT *
FROM (SELECT a1, b1,
row_number() over(ORDER BY A.b1 DESC) rNum
FROM TABLE_A)
WHERE rNum between 1 and 10
***ORDER BY B1 DESC***
yes use order by if you want the final 10 rows ordered by b1. as anything else is not guaranteed (it may happen for the example that its always in order, but things can change)!