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

this one has got me puzzled.. Tried so many ways...

Having a hard time with this one.

Steven Parker
Steven Parker
231,248 Points

Please let us know what you're working on. A link to the course page would help, and also show any code you have written.

SELECT addresses "Maple" ||', '|| "White Plains" || ', ' || "NY" || ', ' || "10605" || ', ' "USA" AS "address";

3 Answers

Steven Parker
Steven Parker
231,248 Points

You need to use column names instead of literal strings for the data values. The instructions tell you specifically which column names to use. And check the strings being used to add the spacing and punctuation. It looks like you may have a comma instead of a period in one, and an extra comma (where only a space is needed) in another.

You also still need the "FROM" clause that names the table being used as the source.

Andrew Winkler
Andrew Winkler
37,739 Points

You need to concatenate all the values with double pipes IN ORDER. You're basically adding words left to right to build a final string value which you're storing in a single column named to_field.

Think of it similar to math:

first_name + space + last_name + space + '<' + email + '>'

... then recall the SQL syntax where + = || and space = ' '... replace the above logic with proper SQL syntax and you get:

first_name || ' '  || last_name || '<' || email || '>'

.. then you've gotta name the new column AS to_field and wrap the statement up. I think you can do it from there.

Thanks so much guys. Im on the second challenge though. Still having trouble with it.

Steven Parker
Steven Parker
231,248 Points

Did you make all the changes I suggested? What does your query look like now?