MySQL database is the world's most popular open source database because of its fast performance, high reliability, ease of use, and dramatic cost savings. As i am using MYSQL with developing my PHP web application, i need to make a simple String operation in MYSQL and i would like to share it with you guys. I need to make a table field values to uppercase first character and than lowercase all other characters. There are UPPER and LOWER inbuilt functions available in MYSQL but it will make values to either uppercase or lowercase. If you need to make database field value to UCFIRST (Capitalize the first letter of each word using MYSQL) than below is the query. You can run it in mysql query command. This behave same as ucfirst function of PHP.
UPDATE countries SET `v_name` = CONCAT(UCASE(SUBSTRING(`v_name`, 1, 1)),LOWER(SUBSTRING(`v_name`, 2)));
I am PHP Freelancer, Rakshit Patel AKA WordPress Freelancer working as PHP Programmer India. I am here to share all my developing knowledge, quick coding techniques, quick solutions to save your time and help you guys for any issue or bug fixing. If you have any PHP, WordPress, Magento related work, please contact me. I am interested for the work.