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

I can't get my head around the aliasing here.

The questions asks you to output the information with email displayed as <email>, but also then asks you to alias the column as "to_field".

I might just be having a mental block here, but I can't work out how to add angled brackets to my strings; and then also don't know how I would format it, as it feels like I'm double-aliasing?

1 Answer

Simon Coates
Simon Coates
4,963 Points

it seems okay with: SELECT first_name || " " || last_name || " <" || email || ">" AS to_field FROM patrons . I'm assuming the problem is more that something about the question is confusing. However, if not, he covers a similar case of concatenation in the video "Adding text columns together"

Hey Simon! I think it was my tired brain misreading the question, I was expecting there to be an auto-function in SQL or a shorthanded way of adding the angled bracket. I didn't think to simply add in string literals to add the brackets in haha.

Thanks so much for your answer though, this is exactly how I ended up solving it!