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 trialomid ayoobe
5,274 Pointsget same results but error in code. SUBSTR(first_name,1,1)
The question asks me to 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. when I do so I get the same results but however, it shows an error.
My code: SELECT SUBSTR(first_name,1,1)|| " " || last_name as "initial" from customers
1 Answer
KRIS NIKOLAISEN
54,972 PointsI'm not sure I understand the error message
Expecting results like 'L Chalkley' not 'L Chalkley'.
because it makes it seem like the columns should be concatenated. But for this challenge the columns are separate. And the alias only applies to the first initial of the first name.
omid ayoobe
5,274 Pointsomid ayoobe
5,274 PointsThank you for your help. you were correct, the first_name should be aliased as "initial" and the last_name is in a separate column.
new code:
SELECT SUBSTR(first_name,1,1) as "initial", last_name from customers