How to capitalize first letter in MySQL

Unlike other (some) DB engines, MySQL does not have a built-in function for capitalizing (capitalize first letter) but the solution can be simple.

option_name ‘original’
CONCAT(UCASE(LEFT(option_name, 1)), LCASE(SUBSTRING(option_name, 2))) Capitalized
from wp_options where LEFT(option_name, 1) <> ‘_’

Leave a Reply

Your email address will not be published.