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 trialkatiehill2
1,265 PointsUpper and Concantate functions question
Link to the challenge question - https://teamtreehouse.com/library/reporting-with-sql/working-with-text/changing-cases-of-strings
Challenge Task 2 of 2
In the library database there's a patrons table with the columns id, first_name, last_name, address, email, library_id, and zip_code. The library is generating new library cards that will display the full name and their library ID. The full name needs to have the last name in all caps. Create a report with two columns of results, one is an alias of full_name the second being the library_id. SELECT (first_name + " " + UPPER(last_name)) AS full_name, library_id FROM patrons;
I am stuck and not sure what I can do to get around this challenge question. Below is what I have tried so far.
First response - SELECT (first_name + " " + UPPER(last_name)) AS full_name, library_id FROM patrons; When answer submitted I get this - Bummer! Expected results to look like "Andrew CHALKLEY", "MCL1001" not 0.0, "MCL1001".
Second response - SELECT (first_name&" "&UPPER(last_name)) AS full_name, library_id FROM patrons; When answer submitted I get this - Bummer! Expected results to look like "Andrew CHALKLEY", "MCL1001" not 0, "MCL1001".
Suggestions from the Community chat I posted. Next response - SELECT CONCAT(first_name," ",UPPER(last_name)) AS full_name, library_id FROM patrons; When answer submitted I get this - SQL Error: no such function: CONCAT
Next response - SELECT concat(first_name," ",UPPER(last_name)) AS full_name, library_id FROM patrons; When answer submitted I get this - SQL Error: no such function: concat
I have no idea how to include screenshots. I am unable to paste them into this text box and don't see an option to attach a document either.
2 Answers
Charlie Elverson
4,243 PointsI think the issue is how you're trying to concatenate strings. Instead of trying to use the "+" to concatenate those strings together, try replacing this:
(first_name + " " + UPPER(last_name))
with this:
concat(first_name, " ", UPPER(last_name)
The change is that the items: first_name, " ", and UPPER(last_name) are being passed into the concat() function instead of being added together with the "+" operator.
scott heggood
2,987 Pointsselect first_name || ' ' || upper(last_name) AS full_name, library_id from patrons;