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

How do I correctly format the email?

The challenge is to generate a list of patrons with the first name , last name and email concatenated. Format email to tiny@email.com how is this done?

2 Answers

Steven Parker
Steven Parker
231,269 Points

You'll notice that in the format sample shown in the instructions, there are some spaces and symbols. You'll need to include some literal strings with your columns as you construct the SELECT clause.

Partial example.:

SELECT /*other bits...*/ || ' <' || email || '>' /*...alias and other clauses*/

I tried this syntax and I'm told it is incorrect SELECT first_name || last_name ||" "|| "<" || email || ">" || as "To" FROM patrons;

I tried this and it did not work. I am working in sql basic / reporting.

Steven Parker
Steven Parker
231,269 Points

You're close, but you still have a few issues:

  • you should use concatenation to place a space between the two names
  • there is a stray extra concatenation symbol at the end (right before the "as" keyword)
  • you aliased the new string as "To", but the instructions say: "Alias it to to_field"

Like this? SELECT last_name || " " || first_name ||' <' || email || '>' AS "to _field" From patrons;

I am still getting an error.

Steven Parker
Steven Parker
231,269 Points

It looks like you reversed the name order since last time, but the challenge is expecting first names first.

Also, your alias is "to _field" (with a space) , but the instructions ask for ""to_field" (no space)