SELECT
CASE
WHEN floor(substr(name, 3,1)) > 0
THEN CONCAT_WS('-', SUBSTRING(name, 1, 2), SUBSTRING(name, 3, LENGTH(name)))
ELSE CONCAT_WS('-', SUBSTRING(name, 1, 3), SUBSTRING(name, 4, LENGTH(name)))
END AS new_name
FROM test
SELECT
CASE
WHEN floor(substr(name, 3,1)) > 0
THEN CONCAT_WS('-', SUBSTRING(name, 1, 2), SUBSTRING(name, 3, LENGTH(name)))
ELSE CONCAT_WS('-', SUBSTRING(name, 1, 3), SUBSTRING(name, 4, LENGTH(name)))
END AS new_name
FROM test