我是中国人。我无法理解为什么MySQL document上的示例“ SELECT'ä'='ae'COLLATE latin1_german2_ci”的结果为1?
此外,我已阅读another article。它将字符集首先设置为latin1,然后“ SELECT'ä'='ae'COLLATE latin1_german2_ci”的结果变为0。为什么同一sql的两个结果不同?是因为字符集不同吗?
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 |
+--------------------------------------+
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)