Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


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 90,705 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