不同数据库'查询第几行到第几行记录'脚本的区别
mysql数据库:
① select * from table limit [offset,] rows | rows offset offset;
② select * from table order by id limit [offset,] rows | rows offset offset;
pgsql数据库:
① select * from table limit 10 offset 20;
② select * from table order by id limit 10 offset 20;
mssql数据库:
① select top 10 * from table where id in (select top 20 id from table order by id) order by id desc;
② select identity(int,1,1) id,* into temp from table;select * from temp id between 10 and 20;
oracle数据库:
① select * from table where rownum < 20
minus
select * from table where rownum < 10;
② select * from (select t.*, row_number() over(order by id)rowid from table t) where rowid between 10 and 20;
上一篇: 揭秘:清朝第一罪人索额图最后怎么死的?
下一篇: redis中数据类型命令整理