很久没做database了,下面是一道SAP的面试题目,望大家指点一下。
“取一个表的第5至第7行记录怎么用SQL表示”
Thanks

解决方案 »

  1.   

    select a.* from tab a where rownum>=5 and rownum<=7
      

  2.   

    select * from 
    (select tablename.*, rownum rn from tablename where rownum <= 7 )
    where rn >= 5
      

  3.   

    SORRY 第一个写错了
    select * from (select rownum num,a.* from tab) a  where a.num>=5 and a.num<=7
      

  4.   

    ....
    select * from (select rownum num,a.* from tab a)   where num>=5 and num<=7