MairDB连接表(四)

2.7TRIM(str):返回字符串str,所有前缀或后缀被删除了。

1.LTRIM(str):返回删除了其前置空格字符的字符串str。

2.RTRIM(str):返回删除了其拖后空格字符的字符串str。

实例

MariaDB [study_db]> SELECT TRIM('    HUAGN  ');

+---------------------+

| TRIM('    HUAGN  ') |

+---------------------+

| HUAGN               |

+---------------------+

1 row in set (0.00sec)

2.8替换REPLACE(str, from_str, to_str):返回字符串str,其字符串from_str的所有出现由字符串to_str代替。

MariaDB[study_db]>SELECTREPLACE('NODEJS','JS','study');

+----------------------------------+

| REPLACE('NODEJS','JS','study') |

+----------------------------------+

| NODEstudy                        |

+----------------------------------+

1rowinset (0.00sec)

2.9 REPEAT(str,count):返回由重复countTimes次的字符串str组成的一个字符串。如果count <= 0,返回一个空字符串。如果str或count是NULL,返回NULL。

MariaDB [study_db]>SELECTREPEAT('HHW',24);

+--------------------------------------------------------------------------+

| REPEAT('HHW',24)                                                        |

+--------------------------------------------------------------------------+

| HHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHWHHW |

+--------------------------------------------------------------------------+

1rowinset (0.00sec)

2.10.1REVERSE(str):返回颠倒字符顺序的字符串str。

MariaDB[study_db]>SELECTREVERSE('123456');

+-------------------+

|REVERSE('123456') |

+-------------------+

|654321|

+-------------------+

1rowinset (0.00sec)

2.10.2SUBSTRING(str, pos):取出str前pos个字符,返回剩余的字符;

MariaDB [study_db]>SELECTSUBSTRING('ABCDEFGHIJKLMN',4);

+--------------------------------+

| SUBSTRING('ABCDEFGHIJKLMN',4) |

+--------------------------------+

| DEFGHIJKLMN                    |

+--------------------------------+

1rowinset (0.00sec)

2.10.3 INSERT(str,pos,len,newstr):返回字符串str,在位置pos起始的子串且len个字符长的子串由字符串newstr代替。

MariaDB [study_db]> SELECT INSERT('1234567890',4,2, 'mariadb');

+---------------------------------------+

| INSERT('1234567890',4,2, 'mariadb') |

+---------------------------------------+

|123mariadb67890                       |

+---------------------------------------+

1row in set (0.00sec)

你可能感兴趣的:(MairDB连接表(四))