For mysql to query Chinese data, I have a large table data volume, and the name field data is both Chinese and English. now I want to find out the data for Chinese? ------ Solution ------------------ standardize the statement first: this & quot; Chinese & quot; although we usually say it makes a clear sense, it is not so clear on the computer .... in utf8, Chinese characters are placed together with Korean and Japanese characters, collectively referred to as cjk... in fact, some mysql queries Chinese data.
I have a large table with a large amount of data, and the name field has Chinese and English Data. now I want to find out which data is Chinese?
------ Solution --------------------
First, standardize the statement:
Although the meaning of this "Chinese" is clear at ordinary times, it is not so clear on the computer ....
In utf8, Chinese characters are put together with Korean and Japanese characters, collectively referred to as cjk... in fact, they also include some full-angle symbols...
In utf8, Chinese characters are basically in the 3-byte zone, and some 4-byte characters are not uncommon,
At the same time, there are still Indian characters in the 3-byte area... because you don't use them, they don't matter...
So let's make it simpler. Suppose you want to find all records with "3-byte utf8 characters ".
You can use this
Name regexp concat ('[', char (0xE0), '-', char (0xEF), '] [', char (0x80 ),'-', char (0xBF), '] [', char (0x80), '-', char (0xBF), ']')
Note that \ xXX cannot be used directly in mysql regular expressions, so char and concat... google cannot find a more convenient method...
In addition, I do not know whether your data contains 2-byte characters (European Greek Latin characters, etc ),
If you are sure there are no... OK !!!
That is to say, apart from single-byte ascii characters, your data is a 3-byte Chinese character ....
You can use a simple method:
Char_length (name )! = Length (name)
------ Solution --------------------
The REGEXP of mysql is not very powerful. try [^ [: alnum:] [: cntrl:] [: space:].