Oracle、SQL Server、MySQL分页方法
测试用例:查询TEST_TABLE表中TEST_COLUMN列的第10-20条数据
1,Oracle分页方法
1 SELECT A.* FROM
2 (
3 SELECT ROWNUM ROWNO, B.* FROM
4 (
5 SELECT * FROM TEST_TABLE
6 WHERE TEST_COLUMN = 'TEST'
7 ORDER BY TEST_TIME DESC
8 )B
9 WHERE ROWNUM <= 20
10 ) A
11 WHERE A.ROWNO >= 10;
2,SQL Server分页方法
1 SELECT TOP 20 * FROM TEST_TABLE
2 WHERE TEST_COLUMN NOT IN
3 (
4 SELECT TOP 10 TEST_COLUMN
5 ORDER BY TEST COLUMN
6 )
7 ORDER BY TEST_COLUMN;
3,MySQL分页方法
1 SELECT TEST_COLUMN FROM TEST_TABLE LIMIT 10,10;