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

Is there a CAP() function in SQL?

Just to capitalize a string literal, like from "foo bar tar" to "Foo Bar Tar".

1 Answer

Steven Parker
Steven Parker
231,186 Points

What you want is typically known as "title case" and sometimes "proper case". Your server might have a built-in function to do this, for example in Oracle it is "INITCAP()".

But for other SQL engines, you might need to create a UDF (user-defined function) to do this. Your favorite search engine can probably find some ready-to-use cut-and-paste code for your specific DB software.