䯄婘嘉䘞饡釕 > 昄扞康 > PostgreSQL > PostgreSQL LIMIT床埖

PostgreSQL LIMIT床埖

準溊寘录桺䆹    䫌 悕垵幥 敘桄䬽橸    敟蓽庺渇

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 

LIMITOFFSET噕螩埻演䘵鄘彖昖臵欔库䫘䔇臯㔗 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

認儖库䫘傖婋䂷悩

www.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 

認儖库䫘傖婋䂷悩

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 
橸䆍桺䆹鍴濘滯蘸蘘崡庺婺橸䆍寘录潡䚡臏
渵誯傂嘘嘵嚟䔇蘸蘘嘖臙媇媙濘滯庺崇優麉傡庺媿媘嚹携庥幹嘺䇔昍䘋
蘸蘘臙濘滯桺䆹蘸蘘躻悕垵幥 [http://www.gitbook.net]
橸桺湺鵻PostgreSQL LIMIT床埖
蘸蘘臙媺䘍寘桺鷆毖:http://www.gitbook.net/html/postgresql/2013/080562.html
婪婔䇺PostgreSQL LIKE臺埖      婋婔䇺PostgreSQL ORDER BY床埖