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 trialSpencer Koss
1,404 PointsCapitalizing One Character in a variable from a Database
So lets say we are using this addresses table as an example with the following variables: Street, City, Zip, State, Country
And we wanted to format this exactly the same way our challenge questions asks however with one added caveat.
We want to assume our Database doesn't already have capital letters in the beginning of Street, City, and State.
Question: How would we manipulate those three variables into capitalizing ONLY the first letter in the variable?
1 Answer
KRIS NIKOLAISEN
54,971 PointsYou could use substr() and upper() functions to capitalize the first letter. For example with city:
SELECT UPPER(SUBSTR(City,1,1)) || SUBSTR(City,2) AS NewCity FROM addresses;
Spencer Koss
1,404 PointsSpencer Koss
1,404 PointsThank you Kris, do you see much implementation of this in real-world scenarios or is the impact insignificant typically?