【运维心得】mysql判断字段中包含中文

日常运营中,有的时候我们需要将某些字段中包含中文的数据查出来。则可以通过以下方法:

原理: 当字符集为UTF-8,并且字符为中文时,length() 和 char_length() 两个方法返回的结果是不相同的。

select * from ma_picture where length(fileurl)!=char_length(fileurl)

猜你喜欢

转载自blog.csdn.net/qq_26834611/article/details/112612200