Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn The COUNT() Function | Aggregate Functions
Introduction to SQL with output checkers

bookThe COUNT() Function

COUNT() is a function that allows you to count rows in a table or count how many rows match certain criteria.

Let's see an example:

12
SELECT COUNT(name) FROM country;
copy

To count the total number of rows in the table, we can use the following syntax:

12
SELECT COUNT(*) FROM country;
copy
Task

Swipe to start coding

Write an SQL query to retrieve the number of rows from the country table where the continent is 'Asia' with a population of over 1000000.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 5. ChapterΒ 3
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

What is the difference between COUNT(name) and COUNT(*)?

Can I use COUNT() with a WHERE clause to count specific rows?

How does COUNT() handle NULL values?

close

Awesome!

Completion rate improved to 2.44

bookThe COUNT() Function

Swipe to show menu

COUNT() is a function that allows you to count rows in a table or count how many rows match certain criteria.

Let's see an example:

12
SELECT COUNT(name) FROM country;
copy

To count the total number of rows in the table, we can use the following syntax:

12
SELECT COUNT(*) FROM country;
copy
Task

Swipe to start coding

Write an SQL query to retrieve the number of rows from the country table where the continent is 'Asia' with a population of over 1000000.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 5. ChapterΒ 3
single

single

some-alt