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

Dan Epstein
Dan Epstein
3,233 Points

Can anyone assist with how to order the statement in the first SQL Concatenation code challenge? I kind of got lost.

Dan Epstein
Dan Epstein
3,233 Points

I started with building on this base: SELECT first_name ||" "|| last_name || " "email FROM patrons;

Where do I place the AS command, and what exactly does the instruction mean, please? "Alias it to to_field. This will be used in the "To" field in email marketing."

I feel kinda redundant, but it's better to get over this now before the real market questions come by :)

6 Answers

Dan,

With what you posted above you have the following issues:

1) email doesn't have a hyphen

2) The alias to_field uses an underscore instead of a hyphen

The following passes the challenge:

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

Your alias should come just after the column(s) being aliased.

SELECT column_name AS alias_name FROM table_name;

Also note the brackets around the email need to be concatenated as well.

Dan Epstein
Dan Epstein
3,233 Points

I am still missing a piece of the puzzle, should the code look somewhat like this? SELECT first_name||" "||last_name || email AS " " FROM patrons;

What value should I put between the quote marks after AS in that case?

Dan Epstein
Dan Epstein
3,233 Points

Any chance we can get one of the instructors on the thread? I'm sure that most of my issue stems from not properly understanding the code question/task, to begin with.

Dan Epstein
Dan Epstein
3,233 Points

This didn't work as well:

SELECT first_name||" "||last_name||" "||"<"||e-mail||">" AS "to-field" FROM patrons;

I'm just about to give up my subscription and try another paid tutorial program. 10 days are pretty long to be stuck on a single task.

Dan Epstein
Dan Epstein
3,233 Points

Thanks, it all started from the basic misunderstanding of the question.