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

Concatenation and alias task2 - SQL reporting

I am on the 2nd task and my output looks exactly like it should, but I am getting an error that it doesn't. I don't see any difference between the expected result and mine. What am I missing? Error below. Query and results in comments further down.


Bummer! Your query didn't retrieve the addresses in the correct format. Expecting 2532 2nd ST, San Diego, California 90222. USA not 2532 2nd ST, San Diego, California 90222. USA.


This is the task: Challenge Task 2 of 2 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

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

Results:

address


2532 2nd ST, San Diego, California 90222. USA 2213 5th PL, Fresno, CA 90266. USA 3521 24th AVE, Fresno, California 90263. USA 3984 2nd AVE, San Diego, California 90246. USA 1271 13th ST, Fresno, CA 90230. USA 575 6th ST, Sacramento, CA 90292. USA 656 1st PL, Sacramento, CA 90270. USA 1190 1st ST, Fresno, CA 90213. USA 1405 6th ST, Fresno, CA 90290. USA 2493 4th ST, Los Angeles, CA 90223. USA 43 Barnetby Road, Beverley, North Humberside hu7 3yk. UK 16 Chantlands Avenue, Hessle, East Yorkshire hu1 2av. UK 14 Richmond Avenue, Hessle, East Yorkshire HU1 9DS. UK 73 Chantlands Avenue, Hessle, East Yorkshire hu1 9wo. UK 13 Barnetby Street, Beverley, East Yorkshire hu13 4lp. UK 37 Barnetby Avenue, Beverley, North Humberside HU5 3BR. UK 64 Barnetby Road, Anlaby, North Humberside HU1 4EG. UK 36 Barnetby Street, Hessle, East Yorkshire HU1 7HX. UK 19 Chantlands Street, Anlaby, North Humberside HU18 1CR. UK 20 Chantlands Street, Beverley, North Humberside HU14 6FD. UK

1 Answer

Steven Parker
Steven Parker
231,269 Points

There are too many spaces in the literal strings, either directly or because of spaces being joined with other spaces.

I just learned about the markdown - sorry

Steven Parker
Steven Parker
231,269 Points

That will come in handy for future questions! I managed to to resolve this issue as-is.