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

Zachary keller
Zachary keller
3,178 Points

Cant understand the question, mainly the end part

"Generate a list of strings that are in the following format: Andrew Chalkley andrew@teamtreehouse.com. Concatenate the first name, last name and email address for all users. Alias it to to_field. This will be used in the "To" field in email marketing."

i need to alias email as <email>? then alias all of it to be to_field?

my code so far

SELECT first_name || " " || last_name || " " || <email> AS to_field FROM patrons

it doesn't say the error now but that means the error is between AS to_field FROM patrons

3 Answers

The field name is email. It doesn't need to be aliased on it's own. However the format for the email field is that it should be enclosed in angle brackets. To do this the angle brackets should be inside quotes and concatenated as well in your SQL statement. Then the entire full name and formatted email is what should aliased as "to_field"

You're pretty close right now. Just need to put quotes around each angle bracket and concatenate.

Zachary keller
Zachary keller
3,178 Points

SELECT first_name || " " || last_name || " " || "<"|| email || ">" AS to_field FROM patrons

like this?

That is one way to pass task 1. Good job.

Zachary keller
Zachary keller
3,178 Points

Thank you, i had MORE trouble form the next task about length but i see its mainly just problem solving. I had the code right just forgot i aliased it to something else. but again THANK YOU for your help :)

Here Is the correct Answer

SELECT first_name || " " || last_name || " " || "<"|| email || ">" AS to_field FROM patrons