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

Jordan Petty
Jordan Petty
4,844 Points

Question About Email column data

This is under the Concatenating Text Objectives portion of "Reporting with SQL".

I am having trouble figuring out how to get the email address to show the "<>" brackets. Apparently that is what my error is. This isn't shown in the last two videos, and I have tried about everything I could think of.

Does anyone have a solution to this?

This is my code:

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

Result:

to_field Andrew Chalkley andrew.chalkley@teamtreehouse.com Dave McFarland dave.mcfarland@teamtreehouse.com Alena Holligan alena.holligan@teamtreehouse.com Michael Poley michael.poley@teamtreehouse.com

2 Answers

Steven Parker
Steven Parker
229,657 Points

:point_right: Just put the angle brackets in your string literals:

SELECT first_name || " " || last_name || " <" || email || ">" AS "to_field" FROM patrons;
Jordan Petty
Jordan Petty
4,844 Points

Thank you Steven. I had something pretty similar. I didn't know the | | could go after "email" with out a second | |.

For some reason the results show to be correct, but only display the names only for some reason.