How to select the nth row in a SQL database table?

后端 未结 30 2943
执笔经年
执笔经年 2020-11-22 06:06

I\'m interested in learning some (ideally) database agnostic ways of selecting the nth row from a database table. It would also be interesting to see how this can b

30条回答
  •  爱一瞬间的悲伤
    2020-11-22 06:49

    In Oracle 12c, You may use OFFSET..FETCH..ROWS option with ORDER BY

    For example, to get the 3rd record from top:

    SELECT * 
    FROM   sometable
    ORDER BY column_name
    OFFSET 2 ROWS FETCH NEXT 1 ROWS ONLY;
    

提交回复
热议问题