Databases Reporting with SQL Working with Text Creating Excerpts

get 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

54,192 Points

I'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.

Thank 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