Recursive CTE with MySQL
ApproachFor each content_text, build a recursive CTE that contains every parts of sentence (including every word, hyphen and space). Put them back together with
# Approach
For each content_text, build a recursive CTE that contains every parts of sentence (including every word, hyphen and space). Put them back together with `GROUP_CONCAT(...)` while capitalizing every word.

# Code
```mysql []
# Write your MySQL query statement below
SELECT 
    content_id, content_text AS original_text,
    GROUP_CONCAT(CONCAT(UCASE(LEFT(part, 1)), LCASE(SUBSTRING(part, 2))) SEPARATOR '') AS converted_text
FROM user_content t
LEFT JOIN LATERAL (
    WITH RECURSIVE parts (idx, part) AS (
        SELECT 1, @next:=REGEXP_SUBSTR(t.content_text, '[a-z]+|\\s|-', 1, 1)
        UNION ALL
        SELECT idx + 1, @next:=REGEXP_SUBSTR(t.content_text, '[a-z]+|\\s|-', 1, idx + 1)
        FROM parts
        WHERE @next IS NOT NULL
    )
    SELECT * FROM parts
) t2 ON 1 = 1
GROUP BY content_id, content_text
```
['MySQL']