本文介绍了MySQL的困难-平假名和片假名被视为相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在mysql数据库上获取ピースSELECT * FROM Edict WHERE japanese ='ピース'但是我得到了3个结果:ヒースビーズピース

I tried to fetch ピース on mysql databaseSELECT * FROM edict WHERE japanese = 'ピース'However I got 3 results which are:ヒースビーズピース

我尝试使用ぴーす作为查询,它也返回相同的结果.SELECT * FROM Edict WHERE Japanese ='ぴーす'

I tried to use ぴーす as the query and it also return the same result.SELECT * FROM edict WHERE japanese = 'ぴーす'

我该如何解决这个问题?

How can I solve this problem?

谢谢

推荐答案

我不确定日语字母,但是您可以使用 BINARY 比较:

I'm not sure about japanese alphabets, but you could use BINARY comparison:

WHERE BINARY japanese = 'ピース'

BINARY关键字将字符串强制转换为二进制表示形式,因此可以进行精确"比较.

BINARY keyword casts string to its binary presentation, thus you have "precise" comparison.

此外,如果japanese列的默认行为是该行为-您可以将其排序规则更改为_bin(这将是更有效的解决方案,而不仅仅是强制转换)

Also, if that behaviour should be default for japanese column - you could change its collation to _bin one (it will be more efficient solution, rather than just casting)

这篇关于MySQL的困难-平假名和片假名被视为相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 11:38