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,069 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!