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

Databases SQL Reporting by Example Day 2: Advanced Selecting Day 2: Review

olu adesina
olu adesina
23,007 Points

SQL help! i know the answer but i want to understand why

There are 267 employees and 15 with last names starting with 'A'. What does this return? SELECT COUNT(1) FROM EMPLOYEES GROUP BY 'A';

the answer is 267 but why

1 Answer

Billy Bellchambers
Billy Bellchambers
21,689 Points

GROUP BY is normally used to group by values which would differ from line to line.

Grouping by a string like this would group all records together under this same value, thus returning the full result set under the grouping of 'A'.