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

Selecting a column so that all the rows would appear between <> operators.

How do I select the column called email from the table called patrons so that all the email would appear between the <> operators. Example: sjhs@hotmail.com.

The email column is to be concatenated with first and last mame columns, and the emails are to show in the format of the example above.

2 Answers

To add in extra strings to your concatenation, just enclose them with double quotes, like so: select first_name || " " || last_name || " <" || email || ">" as to_field from patrons;

Thank you very much, Jason!

Steven Parker
Steven Parker
231,184 Points

You're probably using concatenation already for this challenge, so you can easily concatenate fixed strings along with the other data. For example, if you were just displaying the email alone, you might do this:

SELECT '<' || email || '>' FROM patrons

You might want to remove the link from your example email address so bots don't find it and spam it.:see_no_evil:

Thanks, Steven!