Title - COUNT SQL function Tags - sql functions aggregates

The COUNT() function is the fastest way to calculate how many rows are in a table.

It takes the name of a column as an argument and counts the number of non-empty values in that column.

SELECT COUNT(*) FROM table_name;

  • counts every row.

You can also use a WHERE clause to filter.

SELECT COUNT(*) FROM table_name WHERE price = 0;