总结Oracle,sqlserver,mysql中查询10-20条记录的写法

来源:转载

一: oracle数据库写法:

1:select * from (select rownum rn ,* from 表名 wher rownum<20) a

where a.rn>10

2:select * from 表名 where rownum<20

minus

select * from 表名 where rownum<10

二:SqlServer数据库写法:

1:select top 20 * from tablename where id not?exists (select top 10 * from tablename)//前20条记录再过滤掉前10条

2:select top10 * from (select top 20 * from order by column) order by column desc//子查询中取20条倒序,然后从子查询中取前10条

三:mysql的写法:

select * from tablename where LIMIT 9,10



分享给朋友:
您可能感兴趣的文章:
随机阅读: