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 trialAdrianne Padua
7,506 PointsChallenge Task 2 of String Functions
How do you add the parentheses around the username? I've been looking everywhere on the mySQL documentation website and couldn't find anything. :( Help?
I've tried the following:
SELECT CONCAT(first_name, " ", "("username")") AS display_name FROM users;
and...
SELECT CONCAT(first_name, " ", '('username')') AS display_name FROM users;
and even from what I found on some sites like Stack Overflow...
SELECT CONCAT(first_name, " ", [(]username[)]) AS display_name FROM users;
I've been struggling with this challenge for the past 2 days now. Help? :(
2 Answers
Shahar Polak
5,756 PointsMySQL CONCAT() function is used to add two or more strings. You can concat as many string as you like separated by comma.
I haven't done this course so I'm not familiar with this challenge but from what you wrote I guess this would be it.
SELECT CONCAT(first_name, " (", username, ")") AS display_name FROM users;
Please let me know if it did the trick
Shahar Polak
5,756 PointsHi Adrianne, Sure thing, I'm glad I could be of assistance :)
Adrianne Padua
7,506 PointsAdrianne Padua
7,506 PointsHello Shahar,
My first thought in solving the problem had something to do with commas but wasn't very sure where the commas would be placed. Then I went around Google and other sites and saw other solutions to the problem.
But your solution did the trick. Thank you very much!