为什么“ SELECT'ä'='ae'COLLATE latin1_german2_ci;”的结果是1吗?

时间:2019-09-01 10:09:48

标签: mysql

我是中国人。我无法理解为什么MySQL document上的示例“ SELECT'ä'='ae'COLLATE latin1_german2_ci”的结果为1?

此外,我已阅读another article。它将字符集首先设置为latin1,然后“ SELECT'ä'='ae'COLLATE latin1_german2_ci”的结果变为0。为什么同一sql的两个结果不同?是因为字符集不同吗?

MySQL document上。

mysql> SELECT 'ä' LIKE 'ae' COLLATE latin1_german2_ci;
+-----------------------------------------+
| 'ä' LIKE 'ae' COLLATE latin1_german2_ci |
+-----------------------------------------+
|                                       0 |
+-----------------------------------------+
mysql> SELECT 'ä' = 'ae' COLLATE latin1_german2_ci;
+--------------------------------------+
| 'ä' = 'ae' COLLATE latin1_german2_ci |
+--------------------------------------+
|                                    1 |
+--------------------------------------+

another article上。

mysql> set charset latin1;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT 'ä' = 'ae' COLLATE latin1_german2_ci;
+---------------------------------------+
| 'ä' = 'ae' COLLATE latin1_german2_ci  |
+---------------------------------------+
|                                     0 |
+---------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT 'ä' LIKE 'ae' COLLATE latin1_german2_ci;
+------------------------------------------+
| 'ä' LIKE 'ae' COLLATE latin1_german2_ci  |
+------------------------------------------+
|                                        0 |
+------------------------------------------+
1 row in set (0.00 sec)

0 个答案:

没有答案