Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases Reporting with SQL Working with Text Concatenating Text

Jose Testa
Jose Testa
998 Points

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

Jason Larson
Jason Larson
5,485 Points

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;

Jose Testa
Jose Testa
998 Points

Thank you very much, Jason!

Steven Parker
Steven Parker
210,424 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:

Jose Testa
Jose Testa
998 Points

Thanks, Steven!