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

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

 

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

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

 

posted @ 2021-01-14 15:28  虹梦未来  阅读(11)  评论(0)    收藏  举报  来源