Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Challenge 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;


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

MySQL 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

Hello 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!

Hi Adrianne, Sure thing, I'm glad I could be of assistance :)