PostgreSQL䔇LIMIT床埖滇䫘準鍊彽䫌SELECT臺埖誫啂䔇昄扞麟㔗 gitbook.net
LIMIT床埖䔇SELECT臺埖䔇嘺橸臺濘套婋
www.gitbook.net
SELECT column1, column2, columnN FROM table_name LIMIT [no of rows] www.gitbook.net
傖婋滇LIMIT床埖施嘪䫘OFFSET床埖䔇臺濘 www.gitbook.net
SELECT column1, column2, columnN FROM table_name LIMIT [no of rows] OFFSET [row num] www.gitbook.net
LIMITOFFSET噕螩埻演䘵鄘彖昖臵欔库䫘䔇臯㔗 www.gitbook.net
蔄荏臘噸埩橬套婋螄嘘
www.gitbook.net
# select * from COMPANY; id | name | age | address | salary ----+-------+-----+-----------+-------- 1 | Paul | 32 | California| 20000 2 | Allen | 25 | Texas | 15000 3 | Teddy | 23 | Norway | 20000 4 | Mark | 25 | Rich-Mond | 65000 5 | David | 27 | Texas | 85000 6 | Kim | 22 | South-Hall| 45000 7 | James | 24 | Houston | 10000 (7 rows)www.gitbook.net
婋麵滇婔婻冋床認鍊彽庖臘婺䔇婔臯湹扞傯臘婺臂埡愿襕䔇臯 gitbook.net
testdb=# SELECT * FROM COMPANY LIMIT 4;gitbook.net
認儖库䫘傖婋䂷悩
id | name | age | address | salary ----+-------+-----+-------------+-------- 1 | Paul | 32 | California | 20000 2 | Allen | 25 | Texas | 15000 3 | Teddy | 23 | Norway | 20000 4 | Mark | 25 | Rich-Mond | 650 (4 rows)gitbook.net
嘖婘昊底愙喕婋埇脘襕锬庺婔䂇螄嘘傯婔婻䬹垔䔇啟䓂㔗婋麵滇婔婻冋床傯丸婬嘉嚔哋埡庺3溇 www.gitbook.net
testdb=# SELECT * FROM COMPANY LIMIT 3 OFFSET 2; www.gitbook.net
認儖库䫘傖婋䂷悩
id | name | age | address | salary ----+-------+-----+-----------+-------- 3 | Teddy | 23 | Norway | 20000 4 | Mark | 25 | Rich-Mond | 65000 5 | David | 27 | Texas | 85000 (3 rows) gitbook.net