This is a fix of White Feather answer,
The fix to avoid duplication of first character is to add IF condition in this part
UPPER(SUBSTRING(Name,1,1))
The original code is like this
SELECT
CONCAT(
UPPER(SUBSTRING(Name,1,1)),
LOWER(SUBSTRING(Name,2,Locate(' ', Name)-1)),
UPPER(SUBSTRING(Name,Locate(' ', Name)+1,1)),
LOWER(SUBSTRING(Name,Locate(' ', Name)+2)))
FROM NameTable;
Then updated version will be like this
SELECT
CONCAT(
IF(INSTR(t1.firstname, ' ') > 0, UPPER(SUBSTRING(Name,1,1)),''),
LOWER(SUBSTRING(Name,2,Locate(' ', Name)-1)),
UPPER(SUBSTRING(Name,Locate(' ', Name)+1,1)),
LOWER(SUBSTRING(Name,Locate(' ', Name)+2)))
FROM NameTable;
But this only supports two words, if you have three or more it cannot be capitalized.