Good night, my friend,
To perform this action just use the command SUBSTR(str, pos, len)
from Mysql itself, in this command you must place the string and the desired start and end positions.
Ex:
mysql> SELECT SUBSTR('181202272',0,2);
+--------------------------+
| SUBSTR('181202272',0,2) |
+--------------------------+
| 18 |
+--------------------------+
1 row in set (0.01 sec)
You will do for each part of your string that you want to segment. Next using the command CONCAT (string1, string2,…)
you must carry out the desired concatenation.
mysql> SELECT CONCAT(SUBSTR('181202272',0,2),':',SUBSTR('181202272',2,2));
+--------------------------------------------------------------+
| CONCAT(SUBSTR('181202272',0,2),':',SUBSTR('181202272',2,2)) |
+--------------------------------------------------------------+
| 18:12 |
+--------------------------------------------------------------+
1 row in set (0.01 sec)
Perform the CONCAT
of all the SUBSTR
desired separated by the character you desire.
I hope it helped.
Hugs.
References:
REPLACE
CONCAT