䯄婘嘉䘞饡釕 > 昄扞康 > PostgreSQL > PostgreSQL懫膄淉嘩严

PostgreSQL懫膄淉嘩严

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

蔄荏婔婋臘 COMPANY 橬傖婋螄嘘: gitbook.net

testdb=# 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 | gitbook.net |  24 | Houston2   |  10000
(7 rows)
 www.gitbook.net 

婋麵滇䞔剘䔇冋床滆䴺嘪䫘PostgreSQL懫膄淉嘩严 gitbook.net

婘認麯潏傸噾䂟嘪䫘WHERE床埖儖婘婔婻剘䋸䔇䆹誗蓼麪嘖䯄婘埇傖滯䍘WHERE床埖䫘庯檪婔婻溇傽臺埖婯SELECT臺埖婔蕙㔗

婋麵䔇SELECT臺埖彖臘䔇噖蕇崓庯50,000.00婋準䔇欔橬螄嘘

www.gitbook.net

testdb=# SELECT * FROM COMPANY WHERE SALARY > 50000; gitbook.net 

傖婪PostgreSQL䔇臘嚔库䫘傖婋䂷悩 gitbook.net

 id | name  | age |address    | salary
----+-------+-----+-----------+--------
  4 | Mark  |  25 | Rich-Mond |  65000
  5 | David |  27 | Texas     |  85000
(2 rows)
 gitbook.net 

婋麵䔇SELECT臺埖庖欔橬䔇螄嘘噖蕇京庯20,000.00彖臘

www.gitbook.net

testdb=#  SELECT * FROM COMPANY WHERE SALARY = 20000; gitbook.net 

傖婪PostgreSQL䔇臘嚔库䫘傖婋䂷悩 gitbook.net

  id | name  | age |  address    | salary
 ----+-------+-----+-------------+--------
   1 | Paul  |  32 | California  |  20000
   3 | Teddy |  23 | Norway      |  20000
(2 rows)
 
gitbook.net

婋麵䔇SELECT臺埖庖欔橬䔇螄嘘噖蕇婉京庯20,000.00彖臘 www.gitbook.net

testdb=#  SELECT * FROM COMPANY WHERE SALARY != 20000; www.gitbook.net 

傖婪PostgreSQL臘嚔库䫘傖婋䂷悩

www.gitbook.net

 id | name  | age |  address    | salary
----+-------+-----+-------------+--------
  2 | Allen |  25 | Texas       |  15000
  4 | Mark  |  25 | Rich-Mond   |  65000
  5 | David |  27 | Texas       |  85000
  6 | Kim   |  22 | South-Hall  |  45000
  7 | James |  24 | Houston     |  10000
(5 rows)
 

www.gitbook.net

婋麵䔇SELECT臺埖庖欔橬䔇螄嘘噖蕇婉京庯20,000.00彖臘

gitbook.net

testdb=# SELECT * FROM COMPANY WHERE SALARY <> 20000; www.gitbook.net 

傖婪PostgreSQL䔇臘嚔库䫘傖婋䂷悩

gitbook.net

 id | name  | age | address    | salary
----+-------+-----+------------+--------
  2 | Allen |  25 | Texas      |  15000
  4 | Mark  |  25 | Rich-Mond  |  65000
  5 | David |  27 | Texas      |  85000
  6 | Kim   |  22 | South-Hall |  45000
  7 | James |  24 | Houston    |  10000
(5 rows)
 
www.gitbook.net

婋麵䔇SELECT臺埖彖臘䔇噖蕇崓庯潡京庯65,000.00婋準䔇欔橬螄嘘 gitbook.net

testdb=# SELECT * FROM COMPANY WHERE SALARY >= 65000; 
www.gitbook.net

傖婪PostgreSQL臘嚔库䫘傖婋䂷悩 gitbook.net

 id | name  | age |  address  | salary
----+-------+-----+-----------+--------
  4 | Mark  |  25 | Rich-Mond |  65000
  5 | David |  27 | Texas     |  85000
(2 rows) 
www.gitbook.net
橸䆍桺䆹鍴濘滯蘸蘘崡庺婺橸䆍寘录潡䚡臏
渵誯傂嘘嘵嚟䔇蘸蘘嘖臙媇媙濘滯庺崇優麉傡庺媿媘嚹携庥幹嘺䇔昍䘋
蘸蘘臙濘滯桺䆹蘸蘘躻悕垵幥 [http://www.gitbook.net]
橸桺湺鵻PostgreSQL懫膄淉嘩严
蘸蘘臙媺䘍寘桺鷆毖:http://www.gitbook.net/html/postgresql/2013/080553.html