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

please help!

ive got this

SELECT first_name || " " || last_name || " " || email AS to_field FROM customers;

I felt like i was close but obviously not close enough, could somebody help me with the answer for this question? driving me mad this is!

4 Answers

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there, Sandeep Padda ! Indeed, you are very close. First, you are selecting from the wrong table. The table is named "patrons", but you are selecting from "customers". I know they mean the same thing in English, but SQL doesn't know that :smiley:

Secondly, it actually wants that email to appear in angle brackets just like they have in the example, so somewhere in there you need to concatenate on those brackets. Hint: somewhere in your statement you will need...

" <" || email || ">"

I will leave the placement and the renaming of the table up to you, but you've got this!

Hope this helps! :sparkles:

i stil dont get it, ould you please help with the answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Sandeep Padda I'm sorry the hints weren't enough. I will do my best to explain:

SELECT first_name || " " || last_name || " <" || email || ">"  AS to_field FROM patrons;

This line will select the first name and last name of each person in the patrons table. Note that the table is named patrons and not customers as you have written. Assuming I am in that table and my email address is me@example.com, in a field aliased as to_field, you would find this printed:

Jennifer Nordell me@example.com

This even includes the angle brackets or "<" and ">". Hope this clears things up! :sparkles:

ok i finally got it! couldnt figure out where to put the angle brackets but this worked

SELECT first_name || ' ' || last_name || ' <' || email || '>' AS to_field FROM patrons;

thank you very much for your help Jennifer!