【数据查询】查看数据库A表前100条数据、查询50-100条
前提条件:数据库已储存相应数量数据
查询前一百条数据:
- SQL Server 2000
select top 100 *from A;
- MySQL
select * from A limit 0,100;
查询第50到100条数据:
- SQL Server 2000
select top(51) id from A where id not in (select top(49) id from A);
'51':查询数量(最大-最小+1)
'49':要查询的起始数-1,因为从0开始
- MySQL
select * from A limit 49,51;
‘49’:起始的位置-1,因为从0开始。
‘51’:查询的数量。
查询相关SQL函数