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庖枕京垵潙:
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