Messy text data is a daily reality in analytics — inconsistent casing, stray spaces, combined fields. MySQL's string functions clean and reshape text right inside your queries.
Key Points
- CONCAT('Mr. ', name) joins strings; CONCAT_WS('-', a, b) adds separators
- SUBSTRING(phone, 1, 5) extracts parts; LEFT/RIGHT grab ends
- REPLACE(city, 'Delhli', 'Delhi') fixes typos in bulk
- TRIM removes spaces; UPPER/LOWER standardise case
- LENGTH gives bytes, CHAR_LENGTH gives characters (differs for Hindi/Unicode text)
- LOCATE and SUBSTRING_INDEX split strings like 'first.last@domain.com'
.png)