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 Reporting with SQL Working with Text Concatenating Text

ERROR WHEN CONCATENATING WITH A COMMA

i'M trying to conatenating this code including commas I seem to get an error.

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

2 Answers

Sean T. Unwin
Sean T. Unwin
28,690 Points

You're very close!

There needs to be a space at the end of each of the separator strings, such as ', ' and '. ', while between state and zip there needs one (1) space only (i.e. no comma or period).

I would strongly recommend using singe quotes for String Literals as some database engines dislike double quotes except in specific circumstances.

Thank you Sean, I realized that the spacing between the quotation marks matter.