There is no built-in ordering in the table. Thus, the line number itself is a meaningless metric.
However, you can get the row number of the result set using the ROWNUM psuedocolumn or ROW_NUMBER() analytic function, which is more powerful.
Since there is no need for an explicit ORDER BY clause to order the table in order to work.
select rownum, a.* from ( select * from student where name like '%ram%' order by branch ) a
or using an analytical request
select row_number() over ( order by branch ) as rnum, a.* from student where name like '%ram%'
Your syntax where name is like ... incorrect, there is no need for IS, so I deleted it.
Here ORDER BY relies on binary sorting, so if the branch starts with something other than B, the results may be different, for example, b greater than b .
Ben
source share