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
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!
3 Answers
Bill Ertle
9,286 Pointswow...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.
Bill Ertle
9,286 Pointshi Jason,
it's from SQL Calculating, Aggregating, and Other Functions; the String Functions step; Challenge #2.
Jason Anello
Courses Plus Student 94,610 PointsYour 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.
Bill Ertle
9,286 Pointsso 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
Jason Anello
Courses Plus Student 94,610 Pointsconcat 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.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi Bill,
Which challenge is this from?