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 Grouping Data With Partitions

Peter Kolawa
Peter Kolawa
36,765 Points

I was wondering... why every field has it's own alias but never used it?

For that stage that makes query more cluttered so why even bother? For good practice?

1 Answer

Steven Parker
Steven Parker
231,248 Points

The aliases are used to give column names to the function results.

These aren't just fields being selected, but the results of functions being performed on fields. If you don't give a computed column an alias, the header for that column will show the formula itself (rather ugly).