Capitalised word in mysql

technical talkiess
0

 SELECT CONCAT(

    UPPER(SUBSTRING(word, 1, 1)),

    LOWER(SUBSTRING(word, 2, LENGTH(word) - 1)),

    IF(LOCATE(' ', word) > 0, CONCAT(' ', 

        UPPER(SUBSTRING(word, LOCATE(' ', word) + 1, 1)),

        LOWER(SUBSTRING(word, LOCATE(' ', word) + 2, LENGTH(word) - LOCATE(' ', word) - 1))

    ), '')

) AS capitalized_word

FROM your_table;

Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)