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

Development Tools Database Foundations SQL Calculating, Aggregating and Other Functions String Functions

Select the first letter of the "first_name", add a period after it, followed by a space and add the "last_name". Also, c

stuck again

2 Answers

I had to rewatch the video on how to do this. Thank you for asking the question as this will be helpful in a project I am working on. The key is the build the query step by step.

I first built the basic query with the concat:

SELECT CONCAT() FROM users;

Then start the middle portion of the concat:

SELECT CONCAT(SUBSTRING(first_name, 1, 1)) FROM users;

Then add the period, space, and last name:

SELECT CONCAT(SUBSTRING(first_name, 1, 1), ", ", UPPER(last_name)) AS name FROM users;

Thank you for the help. I had to put a "." instead of a "," as the challenge requests and the code will pass as follows: SELECT CONCAT(SUBSTRING(first_name, 1, 1), ". ", UPPER(last_name)) AS name FROM users;

Its the best answer anyway...

Sorry about that. I was retying the answers and not copy and pasting because of the database nature. I think the more important part of my answer is actually the way I came up with the answer, not the details of this particular answer.

Anyway, happy coding.

Robbie Thomas
Robbie Thomas
31,093 Points

I forgot to throw in FROM users on mine, this is what I had:

SELECT CONCAT(SUBSTRING(UPPER(first_name),1),1) ". ", UPPER(last_name) as name;