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 trialBill Ertle
9,286 PointsMySQL
here's the question:
Select the first letter of the "first_name", followed by a period, followed by a space and then add the "last_name". Also, convert "last_name" to upper case. Alias it as "name". Here's an example: "A. CHALKLEY". The name of the table is "users".
here's my latest failed answer:
select concat(substring(upper(first_name,"."," "),1, 1))), (upper(last_name)) as name from users;
any suggestions would be appreciated
2 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHey Bill,
You didn't link to the challenge, so I can't test this query to see if it works. For future reference, it's always best to click the "Need Help / Get Help" link on the page of the quiz / challenge / video where you are working, as this will link to exactly where you are. I also added markdown to your question to make the code more readable.
However, it seems like you have a small issue with the parenthesis and I don't believe the challenge is asking you to uppercase
the first name call.
SELECT CONCAT(SUBSTRING(first_name, 1, 1), ". ", UPPER(last_name)) AS name FROM users;
and instead of doing the period and space in two separate quotes, I would just use one.
Give that a shot and see if it works.
Andrew Winkler
37,739 PointsYou got your parenthesis in a bind, which is altering the outcome. Should be:
SELECT CONCAT(SUBSTRING(UPPER(first_name),1,1),". ",UPPER(last_name)) AS name FROM users;
Andrew Winkler
37,739 PointsNote: I combined your space and the period to make my version dryer. I don't see the utility of having them separated.
Bill Ertle
9,286 Pointsthank you, andrew!
Bill Ertle
9,286 PointsBill Ertle
9,286 Pointsthat worked...thanks so much, jason!!!