Counts the number of rows or non-NULL values in a column. A fundamental aggregate function in BigQuery for large-scale data analysis.
INT64Diperbarui: 13 Jun 2026COUNT(*) | COUNT(expression) | COUNT(DISTINCT expression)Counts all rows including NULLs
A column or expression. Only non-NULL values are counted
Counts only unique (non-duplicate) values
1 SELECT COUNT(*) 2 FROM `project.dataset.orders`;
Counts the total number of rows in the orders table.
1 SELECT COUNT(email) 2 FROM `project.dataset.users`;
Counts how many users have an email address (non-NULL).
1 SELECT COUNT(DISTINCT customer_id) 2 FROM `project.dataset.transactions`;
Counts how many unique customers have made a transaction.
1 SELECT 2 region, 3 COUNT(*) as total_orders, 4 COUNT(DISTINCT product_id) as unique_products 5 FROM `project.dataset.sales` 6 GROUP BY region 7 ORDER BY total_orders DESC;
Counts total orders and unique products per region.
| region | total_orders | unique_products |
|---|---|---|
| Jakarta | 523450 | 1245 |
| Surabaya | 312200 | 892 |
| Bandung | 245000 | 756 |
Sudah paham COUNT? Latih langsung di browser
Latihan interaktif, langsung di browser.