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
167,733 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
167,733 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
167,733 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)