In orcale, ROWNUM is the number of rows returned from the query, which means that the first line returned is 1, the second line is 2, etc. If you want to return from a table, you can use the following example:
Select Column1, Column2 from Table1 WHERE Rownum <11
But if there is order by order to sort a column, for example:
Select Column1, Column2 from Table1 Where Rownum <11 Order by Column1
Do not get the result of the top 10 lines we want, you need to use a child inquiry at this time:
Select Column1, Column2 from (Selcet Column1, Column2 from table1 Order by Column1) WHERE ROWNUM <11
You can get the results we want.
If you want to get a certain number of line data in the middle, you can use the Minus operation. The following example can return data from the fourth to 10th:
Select Column1, Column2 from Table1 WHERE Rownum <11
minus
Select Column1, Column2 from Table Where Rownum <4