I think using
select rownum st.Branch
from student st
where st.name like '%ram%'
is a simple way; you should add single quotes in the LIKE statement. If you use row_number()
, you should add over (order by 'sort column' 'asc/desc')
, for instance:
select st.branch, row_number() over (order by 'sort column' 'asc/desc')
from student st
where st.name like '%ram%'