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!

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 Reporting with SQL Working with Text Creating Excerpts

Erin DeSpain
Erin DeSpain
6,753 Points

Question with Reporting with SQL Challenge 1/1 appears broken

Challenge Task 1 of 1 In an ecommerce database there's a customers table with id, username, first_name, last_name, password, email and phone columns.

Create a report from the customers table that shows their first initial of their first name and alias it as initial. Select their last name too.

I enter:

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

I get:

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

2 Answers

The error message is a little odd. But what the task wants you to do is select the first character of the first name as initial (makes sense) and select last name as a separate column.

Hi. This syntax is VERY deceptive but I just solved for this... think of it as an order of operations error in parsing this command.

Without giving the answer.. initial should ONLY be paired on the first half of the statement and you don't need the Pipes & Quotes, as the last will be it's own column... Hope this helps future peeps.