PostgreSQL COUNT Function
COUNT
TheCOUNT()function returns the number of rows that matches a specified criterion.
If the specified criterion is a column name,theCOUNT() function returns the number of columns with that name.
Example
Return the number of customers from thecustomers table:
SELECT COUNT(customer_id)
FROM customers;
Run Example »FROM customers;
Note: NULL values are not counted.
By specifying aWHERE clause, you can e.g. return the number of customersthat comes from London:
Example
Return the number of customers from London:
SELECT COUNT(customer_id)
FROM customers
WHERE city = 'London';
Run Example »FROM customers
WHERE city = 'London';

