PostgreSQL䔇COUNT()庘昄滇橔䞔剘䔇媘脘启誕臯螇昄鵇螇䫌SELECT臺埖誫啂䔇螄嘘麂婩橬䫘䔇㔗 www.gitbook.net
婺庖䊖蓼COUNT庘昄蔄荏臘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 | James | 24 | Houston | 10000 (7 rows) www.gitbook.net
䯄婘啺螆湹扞婪臘襕螇䞖攂䔇臯昄婘溴臘婺埇傖套婋淉嘩
www.gitbook.net
testdb=# SELECT COUNT(*) FROM COMPANY ; gitbook.net
傖婪PostgreSQL䔇臘嚔库䫘傖婋䂷悩
count ------- 7 (1 row)gitbook.net
劯湙愿凹Paul䔇螄嘘䔇昄麟準螇䞖闼幽垄埇傖啔套婋 gitbook.net
testdb=# SELECT COUNT(*) FROM COMPANY WHERE name='Paul';www.gitbook.net
count
-------
1
(1 row) www.gitbook.net