表結構:
DROP TABLE IF EXISTS `zhoufoxcn`.`userlist`;
CREATE TABLE? `zhoufoxcn`.`userlist` (
`UserId` int(10) unsigned NOT NULL auto_increment,
`UserName` varchar(45) NOT NULL,
`Age` int(10) unsigned NOT NULL default '10',
`Sex` tinyint(3) unsigned NOT NULL default '1',
`Tall` int(10) unsigned NOT NULL,
`Salary` int(10) unsigned NOT NULL,
PRIMARY KEY? (`UserId`)
) ENGINE=InnoDB AUTO_INCREMENT=694 DEFAULT CHARSET=utf8;
分頁查詢從第N條到第M條記錄的方法
在 MySQL 中表示為:
select * from userlist? order by userId limit n,m
MS SQL Server 中 :
select top (m-n) * from userList where userid not in
(select top? n userid from userList? order by userid) order by userid
Oracle 中 :
select * from (select rownum no,* from userlist where rownum<=m) where no>=n;
Sqlite 數據庫分頁:
sql = "select * from FlyCrocodile where "+條件+" order by "+排序+" limit "+要顯示多少條記錄+" offset "+跳過多少條記錄;
如: select * from flycrocodile limit 15 offset 20
意思是說:?? 從flycrocodile表跳過20條記錄選出15條記錄