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;
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/56210.html
標籤:MySQL
下一篇:2. InnoDB 存盤引擎-InnoDB體系架構、InnoDB的關鍵特性、Master Thread、insert buffer、兩次寫、自適應哈希索引、異步IO
