Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases Reporting with SQL Aggregate and Numeric Functions Review: Aggregate and Numeric Functions

SELECT COUNT(platform) FROM games

There is a question asking what the following line evaluates to:

SELECT COUNT(platform) FROM games;

Since the table has 4 rows, it should be 4. However when I enter this, it says FALSE. How can this be?

1 Answer

andren
andren
28,538 Points

4 is wrong because 2 of the rows contain NULL, which is the absence of data. NULL is not counted by the COUNT function as a value. So the result of that query would actually be 2.

This behavior was mentioned in the Counting Results lecture at the start of this section of the course.

I forgot that completely, thanks a lot!