3 Simple solutions ( Beat 100% ): just replace + string_split + string_agg 🎅🎅🎅
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n![PG.png](https://assets.leetcode.com/users/images/514124b3-2f87-410c-9c01-d2be3fb8f36c_1733318816.7257452.png)\n\n\n# WITH INITCAP(POSTGRESQL)\n```postgresql []\nSELECT content_id, content_text original_text, initcap(content_text) converted_text FROM user_content;\n\n```\n\n# WITHOUT INITCAP ( ALL SQL )\n```postgresql []\nWITH CTE AS(\n\tSELECT content_id, content_text,  unnest(string_to_array(REPLACE(content_text,\'-\',\'  \'), \' \')) AS new_text\n\tFROM user_content \n)\nSELECT content_id, content_text AS original_text , REPLACE( STRING_AGG(UPPER(SUBSTR(new_text,1,1)) || LOWER(SUBSTR(new_text,2, LENGTH(new_text) - 1)), \' \') , \' - \', \'-\')  AS converted_text\nFROM (\n\tSELECT content_id, content_text, CASE WHEN new_text = \'\' THEN \'-\' ELSE new_text END \n\tFROM CTE\n)sub\nGROUP BY content_id, content_text\nORDER BY content_id\n```\n# SQL SERVER \n```mssql []\n\nWITH CTE AS (\n\tSELECT content_id, content_text, REPLACE(content_text,\'-\',\'  \') AS new_text\n\tFROM user_content\n)\n,CTE2 AS (\n\tSELECT\n\t\tcontent_id, content_text, UPPER(LEFT(single_word,1)) + LOWER(SUBSTRING(single_word,2, total_word_length)) AS converted\n\tFROM (\n\t\tSELECT content_id, content_text , new_text, spl.value single_word, LEN(spl.value)total_word_length  FROM CTE C \n\t\tOUTER APPLY\n\t\tstring_split(C.new_text,\' \') spl\n\t)sub\n)\nSELECT content_id, content_text AS original_text, REPLACE( STRING_AGG(IIF( converted = \'\', \'-\',  converted) ,\' \') , \' - \', \'-\') AS converted_text\nFROM CTE2\nGROUP BY content_id, content_text\nORDER BY content_id\n\n```\n\n# ORACLE\n```oracle []\nWITH CTE AS(\n SELECT content_id, content_text, REGEXP_SUBSTR(new_text, \'[^ ]+\', 1, LEVEL) converted_single_text\n   FROM (\n    SELECT content_id, content_text, replace(content_text,\'-\', \' -\') new_text\n    FROM user_content\n)sub \nCONNECT BY REGEXP_SUBSTR(new_text, \'[^ ]+\', 1, LEVEL) IS NOT NULL\n    AND PRIOR content_id = content_id\n    AND PRIOR SYS_GUID() IS NOT NULL\n)\n, CTE2 AS (\nSELECT content_id, content_text, DECODE( is_s, 1, \'-\' || converted_single_text2, converted_single_text2)  AS converted_single_text3, ROW_NUMBER() OVER(ORDER BY (NULL)) keyid\nFROM\n    (\n        SELECT content_id, content_text, is_s, UPPER(SUBSTR(converted_single_text,1,1)) || LOWER(SUBSTR(converted_single_text,2, LENGTH( converted_single_text)))  converted_single_text2\n        FROM (\n            SELECT content_id, content_text, REPLACE(converted_single_text,\'-\',\'\') converted_single_text, CASE WHEN  converted_single_text LIKE \'%-%\' THEN 1 ELSE 0 END is_s\n            FROM CTE\n        )sub\n    ) sub1\n)\nSELECT content_id AS "content_id", content_text AS "original_text", REPLACE( LISTAGG(converted_single_text3, \' \') WITHIN GROUP (ORDER BY keyid) , \' -\',\'-\') AS  "converted_text"\nFROM CTE2 \nGROUP BY content_id, content_text\nORDER BY content_id;\n\n```
['MySQL', 'Oracle', 'MS SQL Server', 'PostgreSQL']