The COUNT()
function returns the number of rows that matches a specified criterion.
If the specified criterion is a column name, the COUNT()
function returns the number of columns with that name.
Return the number of customers from the customers
table:
SELECT COUNT(customer_id)
FROM customers;
Run Example »
Note: NULL values are not counted.
By specifying a WHERE
clause, you can e.g. return the number of customers that comes from London:
Return the number of customers from London:
SELECT COUNT(customer_id)
FROM customers
WHERE city = 'London';
Run Example »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!