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

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,287 Points

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?

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,287 Points

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 :)

Muhammad Anwar Ul Haq
Muhammad Anwar Ul Haq
Full Stack JavaScript Techdegree Student 12,910 Points

Here Is the correct Answer

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