如何删除mysql表中的数字字符?

我在MySQL中有一个名为“Actress”的表.
我想从列“名称”中删除所有数字字符

select * from Actress  limit 5;
+-------+---------------------+
| code  | name                |
+-------+---------------------+
| 11455 | Hanshika_Motwani_19 |
| 11457 | Kajal_Agrwal_11     |
| 11458 | Ileana_21           |
| 11459 | Kaveri_Jha_11       |
| 11462 | Kaveri_Jha_18       |
+-------+---------------------+
5 rows in set (0.00 sec)

如何更新我的表以删除MysqL表中的数字字符,以便我可以得到如下结果

select * from Actress  limit 5;
+-------+---------------------+
| code  | name                |
+-------+---------------------+
| 11455 | Hanshika_Motwani_   |
| 11457 | Kajal_Agrwal_       |
| 11458 | Ileana_21           |
| 11459 | Kaveri_Jha_         |
| 11462 | Kaveri_Jha_         |
+-------+---------------------+
最佳答案
它看起来不是很好,但它的工作原理.它从字符串中删除任何数字

SELECT
    REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE (
    REPLACE( REPLACE( REPLACE( REPLACE('Hallo_1234567890_99','0',''),'1','2','3','4','5','6','7','8','9','');


update Actress 
SET name  = REPLACE( REPLACE( REPLACE( REPLACE( REPLACE( REPLACE (
        REPLACE( REPLACE( REPLACE( REPLACE(name,'');

如果您使用MariaDB,您可以使用REGEX_REPLACE:

update Actress
 set name =  REGEXP_REPLACE(name,'[0-9]','');

样品

MariaDB [(none)]> SELECT REGEXP_REPLACE('A1B2C44','');
+--------------------------------------+
| REGEXP_REPLACE('A1B2C44','') |
+--------------------------------------+
| ABC                                  |
+--------------------------------------+
1 row in set (0.00 sec)

MariaDB [(none)]>

相关文章

目录MySQL卸载环境查看是否已安装MySQL卸载mysql服务查看是否...
目录数据类型数据类型分类数值类型以TINYINT认识整型族有符号...
目录表的约束空属性非空约束(NOT NULL Constraint)默认值定...
目录函数时间日期函数:字符串函数数学函数其他函数 函数 时间...
目录使用C语言连接库的安装C APImysql_initmysql_real_conne...
目录用户用户管理查询所有用户查看当前用户查看当前连接数创...