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

Databases

mySQL

i'm having a problem with the following challenge question:

Select the "first_name" concatenated with the username in parentheses and alias it as "display_name". For example "Andrew (chalkers)". Note that there's a space between the end of the first_name and username in parentheses. The name of the table is "users".

here's my answer:

select concat(first_name," ", last_name(username)) as display_name from users;

thank you for your input!

Hi Bill,

Which challenge is this from?

3 Answers

wow...thanks!

that worked...but i'm not very good at this because i never would have figured this out. i can see what you did, but i still find the 2nd and 4th arguments confusing.

hi Jason,

it's from SQL Calculating, Aggregating, and Other Functions; the String Functions step; Challenge #2.

Your first argument to concat is fine.

The second argument should be a space and a left parenthesis which is what comes before the username.

Your 3rd argument should be username only. last_name is never asked for in this.

The 4th argument should be a string consisting of a right parenthesis since that is what follows the username in the example string.

Let me know if you're still stuck.

so i just ran this and it didn't work:

select concat((first_name)," "), username(last_name) as display_name from users;

so i guess i'm still stuck

concat should have 4 arguments.

concat(first_name, " (", username, ")")

You're taking the first name, then adding on a space and left parenthesis, then the username, and finally a right parenthesis.