The below code shows how you can select the forename field, correcting the data's case. It sets the first character to upper-case and the rest, lower-case.
Code:
SELECT CONCAT(UPPER(LEFT(forename, 1)), (SUBSTRING(LOWER(forename), 2))) As fname
FROM table1;
FROM table1;
Alternatively, if you want to correct the data in the database table, you would...
Code:
UPDATE table1 SET forename = CONCAT(UPPER(LEFT(forename, 1)), (SUBSTRING(LOWER(forename), 2)));
If the table contains a lot of data then, you may wish to run the UPDATE code over night, out of hours!
No comments:
Post a Comment