SQL Knowledge Center · About ·
Easy Interactive Online SQL Training for Beginners

SQL COUNT(*) ... WHERE Tutorial - Filter Database Records

Lesson 13 of 31

COUNT(*) ... WHERE

Interactive SQL Tutorial

We can combine COUNT(*) with WHERE to return the number of rows that matches the WHERE clause.

For example, SELECT COUNT(*) FROM friends_of_pickles WHERE species = 'human'; returns 2.

Can you return the number of rows in friends_of_pickles where the species is a dog?

SQL:

Query Result:

Available Tables: