I had been wondering this for few days. I wanted a solution which could comvert first letter of text in some fields to uppercase and the rest to lower. I got time today and experimented a bit and found a very simple solution.
CREATE TABLEtemp_users
(fname
VARCHAR( 50 ) NOT NULL
Query above makes a temporary table ‘temp_users’ to store the updated data.
INSERT INTOtemp_users
SELECT CONCAT( UPPER( SUBSTRING( fname, 1, 1 ) ) , LOWER( SUBSTRING( fname, 2 ) ) ) , email FROMusers
This query selects the data from the current table, converts the case and inserts into our temporary table ‘temp_users’.
The converted data has now been been stored into a temporary table. Now you can drop the table ‘users’ and rename ‘temp_users’ to ‘users’.
DROP TABLEusers
; RENAME TABLEtemp_users
TOusers
;
And that is all.
Cheers!