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

Code Challenge: Output appears to be what is expected, but is still incorrect

I'm having a tough time passing this Challenge code, as the output for my code appears to be what is expected, but is still incorrect.

Here is my code for the challenge task:

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

Here is the result I'm receiving:

Bummer! Expecting results like 'L Chalkley' not 'L Chalkley'.

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

initial L Chalkley D McFarland P Premaratne A Chalkley R Hinkley L Love N Pettit C Tepper J Hoskins M Poley

Here is the link for the course page I'm working with:

https://teamtreehouse.com/library/reporting-with-sql/working-with-text/creating-excerpts

3 Answers

Steven Parker
Steven Parker
229,732 Points

When the instructions said "Select their last name too.", they meant for you to select it as a separate column.

You won't need to do any concatenation for this challenge.

Ah got it. Thanks Steven!

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

you don't need AS "initial" after last name as you only need that for the first name. So, you put that after the first name SUBSTR.