What MySQL TRIM() function returns if 1st argument(i.e. BOTH, LEADING, TRAILING) is not specified?


By default MySQL will assume the argument BOTH if the 1st argument is not specified in TRIM() function. Following example will demonstrate it.

Example

mysql> SELECT TRIM('A' FROM 'ABCDAEFGAA');
+-----------------------------+
| TRIM('A' FROM 'ABCDAEFGAA') |
+-----------------------------+
| BCDAEFG                     |
+-----------------------------+
1 row in set (0.00 sec)

The above result set shows that when we did not specify 1st argument then MySQL returns the output by assuming BOTH as the 1st argument of TRIM() function.

Updated on: 07-Feb-2020

46 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements