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 trialRichard Nash
24,862 PointsNumeric 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:
COUNT(*)
What am i doing wrong here? I have no idea.
1 Answer
ogechi1
14,455 PointsThanks! I was having the same issue as well
Richard Nash
24,862 PointsRichard Nash
24,862 PointsI 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.