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


Having a hard time with this one. Idk if they want me to make up my own strings or what?

Having a hard time figuring out what they want exactly.

SELECT * FROM patrons first_name || "Andrew " || last_name || "Chalkley " || email || "andrew@teamtreehouse.com " AS to_field;

I tried without names too..

2 Answers

Hi Matthew,

This question is a little tricky. The main idea is to look at what the teacher wants to see returned in the query.

So reading the question, the teacher wants to see: Andrew Chalkley < andrew@teamtreehouse.com > and you're given column names.

We can see the first name, a space, the last name, another space a right angle bracket, an email, and a left angle bracket. Also, the teacher says to put it in this format so you can just use the column names and you don't have to worry about a specific name or email. Last, make sure you place all of the alias stuff inside the SELECT statement. The FROM statement should come afterward.

Your query should look more like this:

SELECT first_name || ' ' || last_name || ' <' || email || '>' AS to_field FROM patrons;
Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hi Matthew,

Try this query as it is

SELECT * FROM patrons first_name || "Andrew " || last_name || "Chalkley" || email || "andrew@teamtreehouse.com" AS to_field;

I think what may be happening is you have a trailing space in value for last name And also in the email field. I don't think it would necessarily affect the query too much in practice but the code challenge won't like it. :-)

still getting an error on it. > SELECT * FROM patrons first_name || "Andrew" || last_name || "Chalkley" || email || "andrew@teamtreehouse.com" AS to_field;

SQL Error: near "||": syntax error