gpt4 book ai didi

mysql - 如何在 MySQL 中搜索确切的字符串值?

转载 作者:行者123 更新时间:2023-11-29 01:51:49 25 4
gpt4 key购买 nike

我得到了这段代码:

select * from locality WHERE name ="ISTASYON"

这与 mySQL 完美配合。问题来了,当我尝试执行但结果不正确时

结果代码:

28BAF9346A41E4E4E0501AAC4524363B    0       iSTASYON
402881a4523b52d201523b6c2afb4166 0 İSTASYON
402881a4523b52d201523b6c38b7417c 0 İSTASYON
402881a4523b52d201523baa9faf0092 0 İSTASYON
402881a4523b52d201523baab059009f 0 İSTASYON
402881a4523b52d201523baad01a00b7 0 İSTASYON
58441bc4c054447ebe1cddbfeef958b5 0 ISTASYON
fa7fb88d1d4c41feb497b08f42066c82 1 2016-04-19 09:53:41.000000 İSTASYON

我的问题是结果包含 ISTASYON、İSTASYON、ıSTASYON、iSTASYON,但我只想 ISTASYON

如何解决这个问题?

最佳答案

您可以使用COLLATEBINARY 运算符来强制进行二进制比较:

SELECT * FROM locality WHERE name COLLATE utf8_bin = "ISTASYON"

SELECT * FROM locality WHERE BINARY name = "ISTASYON"

如果您希望始终以这种方式处理该列,请使用二进制排序规则对其进行声明。
查看docs了解更多信息。

关于mysql - 如何在 MySQL 中搜索确切的字符串值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39791894/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com