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!

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

Development Tools

Richard Nash
Richard Nash
24,862 Points

Numeric and Aggregate Functions Code challenge 1 or 3

Here is the question:

Count all rows in the "users" table and alias it as "user_count".

Here is my code:

SELECT COUNT(*) FROM users AS user_count

Here is what I get when i run it:


What am i doing wrong here? I have no idea.

Richard Nash
Richard Nash
24,862 Points

I figured it out. I had to change the order of the statements. The AS statement has to come before the FROM statement, like this:

SELECT COUNT(*) AS user_count FROM users

That is the correct answer.

1 Answer

Thanks! I was having the same issue as well