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

Possible Wrong Answer?

image

What is the result you should expect from the following query?

SELECT COUNT(platform) FROM games;

Hi, Isn't the answer to this question 4? I've chosen 4 and it said I'm wrong. If it isn't could you tell me why?

regards,

Jaeson

2 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, jaesonshin! No, it's not incorrect. Remember, that you're counting the number of platforms listed in that table. And there are only two platforms listed. There is only "NULL" and "Xbox One". Thus, the answer should be two. If you were counting the names of the games then it would be 4.

Hope this helps! :sparkles:

Oh.. yes. COUNT() does not count NULL.

Thank you, Jennifer!!

Jaeson

Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

jaesonshin That's exactly correct! It does not count NULL so in this case, you get a result of 2 because it counts "Xbox One" twice. However, had you done COUNT(DISTINCT(platform)) you would get a result of 1 because NULL doesn't count at all and the "Xbox One" is repeated :smiley: