?????? ???
????3.1 ????? ???????
mysql> SELECT * FROM user G;
*************************** 1. row ***************************
name: robin
*************************** 2. row ***************************
name: ?1???
2 rows in set (0.00 sec)
mysql> SELECT name??
->     CASE name REGEXP "[u0391-uFFE5]"
->         WHEN 1 THEN "???????????"
->         ELSE "?????????"
->     END AS "?ж?????????????"
-> FROM user;
+
-----------+-----------------------------+
| name      | ?ж????????????? |
+
-----------+-----------------------------+
| robin     | ???????????          |
| ?1??? | ?????????             |
+
-----------+-----------------------------+
2 rows in set (0.00 sec)
mysql> SELECT name FROM user WHERE NOT (name REGEXP "[u0391-uFFE5]");
+
-----------+
| name      |
+
-----------+
| ?1??? |
+
-----------+
1 row in set (0.00 sec)
????3.2 ?????? length() ?? char_length()
mysql> SELECT name?? length(name)?? char_length(name) FROM user;
+
-----------+--------------+-------------------+
| name      | length(name) | char_length(name) |
+
-----------+--------------+-------------------+
| robin     |            5 |                 5 |
| ?1??? |           20 |                 9 |
+
-----------+--------------+-------------------+
2 rows in set (0.00 sec)
mysql> SELECT name FROM user WHERE length(name)  char_length(name);
+
-----------+
| name      |
+
-----------+
| ?1??? |
+
-----------+
1 row in set (0.00 sec)
?????? ???
??????????У?[u0391-uFFE5] ?????????????????
???????????У?????????UTF-8?????????????????length() ?? char_length() ??????????????????????
?????ο?????????
????LENGTH()
????Return the length of a string in bytes
????Returns the length of the string str?? measured in bytes. A multibyte character counts as multiple bytes. This means that for a string containing five 2-byte characters?? LENGTH() returns 10?? whereas CHAR_LENGTH() returns 5.
????CHAR_LENGTH()
????Return number of characters in argument
????Returns the length of the string str?? measured in characters. A multibyte character counts as a single character. This means that for a string containing five 2-byte characters?? LENGTH() returns 10?? whereas CHAR_LENGTH() returns 5.
?????? Ref
????12.5 String Functions