mysql更新脚本问题.所有txt都是小写,只是首字母是大写 [英] mysql update script problem. all txt is lower case just first letter is upper case

查看:110
本文介绍了mysql更新脚本问题.所有txt都是小写,只是首字母是大写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在mysql数据库中的文字.

This are my text in mysql database.

Otok Pasman, Kraj
Otok pasman,Kraj
Otok Pasman , Kraj
Otok pasman, Kraj
Otok PASMAN, Kraj

我如何自动将所有行更改为小写,首字母必须为大写且"始终为,"?

How can i automatically change all rows to lower case, first letter must be upper case and " , " is always ", "?

像这样:

Otok Pasman, Kraj

以及数据库中的所有其他文本,例如此示例?

and all other text in database like this example?

推荐答案

类似的方法应该起作用:

something like this should work:

UPDATE `table` 
SET `field` = REPLACE(CONCAT(UPPER(LEFT(`field`, 1)), LOWER(SUBSTRING(`field`, 2))),' , ', ', ')

这篇关于mysql更新脚本问题.所有txt都是小写,只是首字母是大写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆