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

concatination ..challaege

In an ecommerce database there's a addresses table. There is an id, nickname, street, city, state, zip, country and user_id columns. Concatenate the street, city, state, zip and country in the following format. Street, City, State Zip. Country e.g. 34 NE 12 st, Portland, OR 97129. USA. Alias the concatenated string as address

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

1 Answer

Steven Parker
Steven Parker
231,248 Points

Your query looks good.

You didn't provide a link to the challenge, but if it is this one, I pasted in your query and it passed! :+1:

One minor improvement you could make is to take advantage of the fact that your literal strings can contain more than one character:

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

But this change should not affect the output at all, and it should have worked as-is.