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

In an ecommerce database there's a customers table with id, username, first_name, last_name, password, email and phone c

SELECT SUBSTR(first_name, 1, 1) || " & " || last_name AS initial FROM customers;

What did I do wrong?

Steven Parker
Steven Parker
229,981 Points

Can you provide a link to the challenge itself?

4 Answers

J.D. Sandifer
J.D. Sandifer
18,813 Points

You have the right idea, you're just doing more than this problem actually wants. To clarify, what it wants you to do is:

Select 2 things: first initial of the first name and the last name, and alias one of them: first initial as initial.

The result should be a table with two columns like this:

initial       last_name
A             Smith
J             Jones
B             Franklin

I still dont understand, when i run it i get the error : Bummer! Expecting results like L & Chalkley not L & Chalkley. ;

I think the problem is because of the column

Farnoosh Johnson
Farnoosh Johnson
7,887 Points
SELECT SUBSTR(first_name, 1, 1) AS initial , last_name AS last_name FROM customers;

Oh so you dont need the '&' between the initial and last name. I got it now .. The wording of the error message confused me.

horus93
horus93
4,333 Points

Also, something to note, it's unnecessary to alias last_name as anything, because the challenge doesn't ask for an alias, and aliasing it as itself like "last_name AS last_name" is redundant and changes nothing.