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.



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

In the code editor, run:

SELECT COUNT(*) FROM fake_apps;

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

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?