Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Data Analysis

jessicakelly
jessicakelly
5,901 Points

I need help with my sql!

Ok, so here it is...

I am writing the "COUNT()" function with all the possibilities I can think of; but it just won't work. I need help!

jessicakelly
jessicakelly
5,901 Points

Well I mean it will tell me that I am miss using it.

2 Answers

Steven Parker
Steven Parker
231,261 Points

There are a few ways to use COUNT. For one, you can either count rows or fields. To count rows, I usually use the number 1 as the argument (some people like to use * instead). And when counting fields, you can either just name the field to count all non-null values in that field, or precede it with the word DISTINCT to count only the unique values of that field.

To facilitate a more thorough analysis of your issue and a more specific answer, be sure to show your SQL code and provide a link to the course page you are working with.