Databases Reporting with SQL Working with Text Concatenating Text

Dan Epstein
Dan Epstein
2,794 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
2,794 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

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 42,619 Points

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;
KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 42,619 Points

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
2,794 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
2,794 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
2,794 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
2,794 Points

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