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

Complex question please help

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.

My answer: SELECT SUBSTR(<first_name>, <1>, <length>) AS "initial" AND SELECT SUBSTR (<last_name>, <1>, <length>);

This formula does not look right to me, I'm not quite sure what the question is asking of me to do and I don't know how to work out the length hence i left that blank could someone explain to me please

1 Answer

Steven Parker
Steven Parker
231,268 Points

It looks like you may have taken some documentation too literally. Documentation often surrounds terms in angle brackets to identify parameters that will be substituted by actual values. The angle brackets themselves are not part of the syntax, so "<first_name>" should just be "first_name". And "<length>" should be replaced by an actual number that represents the length.

And when the instructions say "Select their last name too" they mean the entire last name, you won't need to get a SUBSTR on that one.

Items in a select list should be separated by commas instead of the word "AND".

Finally, don't forget the "FROM" clause that names the table that the data will be coming from.