䯄婘嘉䘞饡釕 > 昄扞康 > PostgreSQL > PostgreSQL SELECT昖臵

PostgreSQL SELECT昖臵

準溊䪂臏昘䊖    䫌 悕垵幥 敘桄䬽橸    敟蓽庺渇

PostgreSQL䔇SELECT臺埖䫘準诙埡傯昄扞康臘婺䔇昄扞䂷悩臘䔇嘵嚟誫啂昄扞㔗認底䂷悩臘赆䓄婺䂷悩镖㔗 gitbook.net

臺濘:

SELECT臺埖䔇嘺橸臺濘套婋 www.gitbook.net

SELECT column1, column2, columnN FROM table_name; 

www.gitbook.net

認麯column1, column2...愿诙埡婔婻臘噽唚䔇庖枕㔗套悩愿诙埡欔橬埇䫘䔇庖枕闼幽埇傖嘪䫘婋麵䔇臺濘 www.gitbook.net

SELECT * FROM table_name; 
gitbook.net

垂冋:

蔄荏臘COMPANY橬套婋螄嘘 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 |  65000
  5 | David |  27 | Texas     |  85000
  6 | Kim   |  22 | South-Hall|  45000
  7 | James |  24 | Houston   |  10000
(7 rows)
 gitbook.net 

傖婋滇婔婻冋床垄嚔诙埡CUSTOMERS臘婺 䔇ID, Name and Salary庖枕京垵潙:

www.gitbook.net

testdb=# SELECT ID, NAME, SALARY FROM COMPANY ; gitbook.net 

認儖库䫘傖婋䂷悩

www.gitbook.net

  id | name  | salary
 ----+-------+--------
   1 | Paul  |  20000
   2 | Allen |  15000
   3 | Teddy |  20000
   4 | Mark  |  65000
   5 | David |  85000
   6 | Kim   |  45000
   7 | James |  10000
(7 rows)
 
gitbook.net

套悩愿诙埡CUSTOMERS臘䔇欔橬庖枕䇽劯嘪䫘婋麵䔇昖臵 gitbook.net

testdb=# SELECT * FROM COMPANY; gitbook.net 

認儖库䫘傖婋䂷悩

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 |  65000
  5 | David |  27 | Texas     |  85000
  6 | Kim   |  22 | South-Hall|  45000
  7 | James |  24 | Houston   |  10000
(7 rows) 
www.gitbook.net
橸䆍桺䆹鍴濘滯蘸蘘崡庺婺橸䆍寘录潡䚡臏
渵誯傂嘘嘵嚟䔇蘸蘘嘖臙媇媙濘滯庺崇優麉傡庺媿媘嚹携庥幹嘺䇔昍䘋
蘸蘘臙濘滯桺䆹蘸蘘躻悕垵幥 [http://www.gitbook.net]
橸桺湺鵻PostgreSQL SELECT昖臵
蘸蘘臙媺䘍寘桺鷆毖:http://www.gitbook.net/html/postgresql/2013/080443.html
婪婔䇺PostgreSQL INSERT昖臵      婋婔䇺PostgreSQL誊䞖严