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
MOD
Sean T. Unwin
Treehouse Moderator 28,349 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.