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 trialxczurymqdj
2,289 Pointsim not sure what im doing wrong with my code, can someone please tell me what im doing wrong
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
xczurymqdj
2,289 PointsSorry about that, here is my code.
SELECT street || " " || city || " " || state || " " || zip || " " || country || " " || AS address FROM addresses
4 Answers
Joseph Yhu
PHP Development Techdegree Graduate 48,637 PointsYou are missing a few punctuations, and you have concatenated an extra unnecessary space at the end. Here's what the format should look like (with emphasis surrounded by asterisks): street*,* city*,* state zip*.* country
Your code
SELECT street || " " || city || " " || state || " " || zip || " " || country || " " || AS address FROM addresses
xczurymqdj
2,289 PointsSo the code should be: SELECT street, city, zip, country AS address FROM addresses;
Joseph Yhu
PHP Development Techdegree Graduate 48,637 PointsYou are missing ||
s and quote marks. Also the punctuation after the zip should be a period not a comma.
You are also missing the state.
SELECT street || ", " || city || ", " || state || " " || zip || ". " || country AS address FROM address;
Indhira Acevedo
1,894 Pointsi try and try and im stuck in the error.
my code is : SELECT street || ", " ||city|| ", " ||state|| " " ||zip|| '.' ||country as address from addresses;
and the message is this:Your query didn't retireve the addresses in the correct format. Expecting 2532 2nd ST, San Diego, California 90222. USA not 2532 2nd ST, San Diego, California 90222.USA.
I cant seem to get right how to separate 90222.USA to 90222. USA. Ive tried " " after and before ||country and nothing.
Indhira Acevedo
1,894 Pointsi figured it out
Joseph Yhu
PHP Development Techdegree Graduate 48,637 PointsJoseph Yhu
PHP Development Techdegree Graduate 48,637 PointsWe won't know unless you share your code.