Skip to Content
Learn
Aggregate Functions
Count

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

COUNT() is a function that 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;

Here, we want to count every row, so we pass * as an argument inside the parenthesis.

Instructions

1.

Let’s count how many apps are in the table.

In the code editor, run:

SELECT COUNT(*) FROM fake_apps;
2.

Add a WHERE clause in the previous query to count how many free apps are in the table.

Folder Icon

Take this course for free

Already have an account?