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

phas
phas
2,358 Points

"Expecting results of L Chalkley, not L Chalkley" error.

Don't quite understand why I am getting this, did I do something wrong? The code below generates the correct table. Does the code challenge expect something else?

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

2 Answers

Anders Prytz
Anders Prytz
26,193 Points

Hi.

Just did the exercise myself. The task doesn't want you to concatinate the results, it wants it in two different columns having the initial and last_name in separate columns. You are getting the correct information, but not in the expected way.

SELECT SUBSTR(first_name, 1, 1) AS 'initial', last_name FROM customers; -> should do the trick.

phas
phas
2,358 Points

Fantastic thanks, the response to my incorrect answer didn't make it clear.

Steven Parker
Steven Parker
231,248 Points

Isn't that exactly what I said, guesses and and all?

Steven Parker
Steven Parker
231,248 Points

Perhaps you don't have the right number of columns.

You didn't provide a link to the challenge so I could check, but just guessing from the name of the alias, I'd bet it was intended to be applied only to the result of the function. And I'd also guess that the last name was intended to be a separate column, with no concatenation involved.

If that's not it, please provide a link the course page and I'll take another look.

phas
phas
2,358 Points

Apologies, first time here in a while.
https://teamtreehouse.com/library/reporting-with-sql/working-with-text/creating-excerpts

Here is the question as well in case I did not link the page correctly.

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.

Thank you for the help, I appreciate it!