Ways to clean data (trim unneccesary space & chars) - MySQL
You can use TRIM():

SELECT TRIM('  cognac    ');
-&gt; 'cognac'


Or:

SELECT TRIM(BOTH 'x' FROM 'xxxxcognacxxxx')
-&gt; 'cognac'


Or cascade multiple characters:

SELECT TRIM(BOTH 'c' FROM (TRIM(BOTH 'x' FROM 'xxxxcognacxxxx')))
-&gt; 'ogna'


You can also look at this question for REGEX replace using a function: How to do a regular expression replace in MySQL?