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

Y B
Y B
14,136 Points

SQL Challenge substring

The 3rd challenge in the question I can't seem to get past.

The question is: Select the first letter of the "first_name", add a period after it, followed by a space and add the "last_name". Also, convert "last_name" to upper case. Call it "name". Example: "A. CHALKLEY".

My answer is: SELECT CONCAT(SUBSTRING(first_name,1,1), ".", " ",(UPPER(last_name)) AS name FROM users;

I've tried lots of times in slightly different ways but it doesn't seem to work. Any ideas? Thanks

4 Answers

I'm not sure what error they're throwing, but the answers they are looking for are often very specific on the code.

You have your period (.) and space " " separated, and they don't really have to be, you can do that in 'one' set of quotation marks

Y B
Y B
14,136 Points

Thanks I did try that before - but with no luck. Anyway I did finally get it to work, with pretty much my answer above, not sure what the error was?

Well you said 'pretty much' your answer above, so what did you change?

Y B
Y B
14,136 Points

Thanks really not sure what the difference is (perhaps a space somewhere). I get that I few times on some of the SQL queries they don't work, I retype the same thing and then they work?

Nicholas Oliveri
Nicholas Oliveri
729 Points

SELECT CONCAT(SUBSTRING(first_name,1,1),”.”,” “,UPPER(last_name)) AS name FROM users;

its seems to be very specific about spaces within the brackets, so dont space use a comma instead