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

Damir Lihter
Damir Lihter
9,639 Points

SQL code doesn't work

I am trying to solve a task in REPORTING WITH SQL. Here is my code: SELECT street || ", " || city || ", " || state || " " || zip || ". " || country FROM addresses AS "address";

It returns desired result but I get the "Bummer!". I don't know what is wrong.

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Hi Damir,

You'll need to link directly to the challenge in order for us to properly help you troubleshoot. This can be done easiest by asking the question using the "Get Help" button inside of the challenge, as this will link directly to the challenge and automatically include your code that you are trying.

For now, you could just copy/paste the direct link into a comment here.

Challenges are very specific and picky. Sometimes, it could be as simple as punctuation, capitalization, or spacing. But, we will need the link to the challenge to see.

:dizzy:

1 Answer

Steven Parker
Steven Parker
231,248 Points

:point_right: The alias must come before the "FROM" clause.

The one obvious issue that I can see without a reference to the challenge is that you have placed your FROM clause between the concatenated select fields and the alias (the AS clause). The alias must come immediately after the fields that it applies to.

SELECT street || ", " || city || ", " || state || " " || zip || ". " || country AS address FROM addresses;

And it doesn't hurt, but you don't need quotes around an alias unless it contains spaces or other unusual characters.

Damir Lihter
Damir Lihter
9,639 Points

Thank you Steven! Really don't know how I didn't see that AS statement. Did that enough to know it goes AFTER what needs to be aliased. It works perfectly now! :) Thanks again!