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

General Discussion

Problem with code challenge after SQL calculating, aggregating and other functions

The assignment was to count the number of rows in the users table and alias the result as "user_count".
I entered SELECT COUNT(*) FROM users AS user_count;

I tried it several times and it was not accepted, I tried exactly the same thing in the SQL Workbench and it worked properly.

2 Answers

Joseph Kato
Joseph Kato
35,340 Points

I think the issue is with your alias assignment; you want to assign it to just the count, like so:

SELECT COUNT(*) AS user_count FROM users;

That worked! I guess it thought the alias was for the table, not for the count. Thanks,