Selecting the second row of a table using rownum

后端 未结 9 1478
栀梦
栀梦 2020-11-28 14:07

I have tried the below query:

select empno from (
                   select empno 
                     from emp
                    order by sal desc
               


        
9条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 14:58

    try this way it's working 100% SQL> SELECT * FROM STUD;

    RNUMBER SNAME MARKS


       104 mahesh                       85
       101 DHANU                        20
       102 BHARATH                      10
       100 RAJ                          50
       103 GOPI                         65
    

    SQL> select * from(select MARKS,ROWNUM AS RS from ( select * from stud order by marks desc)) where RS=2;

     MARKS         RS
    

        65          2
    

    SQL>

提交回复
热议问题