The COUNT function returns the number of input rows that match a specific condition of a query.
Syntax:
-- COUNT
SELECT COUNT(*)/ COUNT(column)/ COUNT(DISTINCT column)
FROM table;Example: Number of transactions in the payment table
-- Count the number of transactions in the payment table
SELECT COUNT(*)
FROM payment;## count
## 1 14596
Example: Number of distinct transactions in the payment table
-- Count the number of transactions in the payment table
SELECT COUNT(DISTINCT(amount))
FROM payment;## count
## 1 19