SELECT CONCAT(UPPER(SUBSTRING(firstName, 1, 1)), LOWER(SUBSTRING(firstName FROM 2))) AS properFirstName
from MYSQL Website
so for your Problem:
SELECT CASE WHEN LENGTH(first_name) = 2 OR (LENGTH(first_name) = 3 AND first_name LIKE '% %') -- check if Initials as first name
THEN CONCAT(UPPER(REPLACE(first_name, " ", "")), -- initials in UPPER, no spaces
" ",
UPPER(SUBSTRING(last_name, 1, 1)), -- First letter last Name
LOWER(SUBSTRING(last_name FROM 2))) -- Rest last Name
ELSE (CASE WHEN first_name LIKE '% %' -- check if first_name contains space
THEN CONCAT(UPPER(SUBSTRING(first_name, 1, 1)),
LOWER(SUBSTRING(first_name, 2, INSTR(first_name, " ")-2)),
" ",
UPPER(SUBSTRING(first_name, INSTR(first_name, " ")+1, 1)),
LOWER(SUBSTRING(first_name FROM INSTR(first_name, " ")+2)),
" ", -- Space between first and last Name
UPPER(SUBSTRING(last_name, 1, 1)), -- First letter last Name
LOWER(SUBSTRING(last_name FROM 2))) -- Rest last Name
ELSE CONCAT(UPPER(SUBSTRING(first_name, 1, 1)), -- First letter first Name
LOWER(SUBSTRING(first_name FROM 2)), -- Rest first Name
" ", -- Space between first and last Name
UPPER(SUBSTRING(last_name, 1, 1)), -- First letter last Name
LOWER(SUBSTRING(last_name FROM 2))) END)END AS properName -- Rest last Name
not very pretty though