MySQL DB 选择带变音符号和不带变音符号的记录。例如:'..其中某物= FÖÖ'
我的表排序规则是“utf8_general_ci”。如果我运行如下查询:
SELECT * FROM mytable WHERE myfield = "FÖÖ"
我得到的结果在哪里:
... myfield = "FÖÖ"
... myfield = "FOO"
这是“utf8_general_ci”的默认值吗?
我应该使用什么排序规则来仅获取 myfield =“FÖÖ”的记录?
My Table collation is "utf8_general_ci". If i run a query like:
SELECT * FROM mytable WHERE myfield = "FÖÖ"
i get results where:
... myfield = "FÖÖ"
... myfield = "FOO"
is this the default for "utf8_general_ci"?
What collation should i use to only get records where myfield = "FÖÖ"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MySQL 为 Unicode 字符集提供的排序规则列表可以在此处找到:
http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html
如果你想全力以赴并要求字符串绝对是相同为了测试相等,您可以使用
utf8_bin
(二进制排序规则)。否则,您可能需要对提供的不同排序规则进行一些实验。A list of the collations offered by MySQL for Unicode character sets can be found here:
http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html
If you want to go all-out and require strings to be absolutely identical in order to test as equal, you can use
utf8_bin
(the binary collation). Otherwise, you may need to do some experimentation with the different collations on offer.对于斯堪的纳维亚字母,您可以使用 utf8_swedish_ci fir 示例。
这是 utf8_swedish_ci 的字符分组。它显示哪些字符被解释为相同。
http://collation-charts.org/mysql60/mysql604.utf8_swedish_ci.html
这是其他排序规则的目录列表。我不确定哪个是使用的 utf8_general_ci 。 http://collation-charts.org/mysql60/
For scandinavian letters you can use utf8_swedish_ci fir example.
Here is the character grouping for utf8_swedish_ci. It shows which characters are interpreted as the same.
http://collation-charts.org/mysql60/mysql604.utf8_swedish_ci.html
Here's the directory listing for other collations. I'm no sure which is the used utf8_general_ci though. http://collation-charts.org/mysql60/