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
Yung Hua HSIAO
10,430 PointsHelp !!! Select the "first_name" concatenated with the username in parentheses and alias it as "display_name".
I have no idea why i can't pass the second 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".
And my Answer is :
SELECT CONCAT(first_name," ",username) AS display_name FROM users;
Where is my mistake?? thanks guys
1 Answer
Alex Heil
53,547 Pointshey Yung Hua HSIAO , you're already pretty close with your current answer. the only part missing is the surrounding brackets for the display name. currently your statement evaluates to: Andrew chalkers - while we need Andrew (chalkers)
if you add in the brackets it will work fine, like so:
SELECT CONCAT(first_name, " (", username, ")") AS display_name FROM users;
in detail this reads as: first name + a space with the opening bracket + the display name + the closing bracket.
hope that helps and have a nice day ;)
Kira Saprykina
4,017 PointsAwesome! Thank you :)
Craig Watson
27,930 PointsCraig Watson
27,930 PointsHi,
I am not great with SQL as I have had limited time using it but I have found a couple of good answers on stackoverflow that may help on this thread.
Hope this helps in some way :)
Craig