如何在日语版的MySQL中设置架构排序规则 [英] How to set schema collation in MySQL for Japanese

查看:110
本文介绍了如何在日语版的MySQL中设置架构排序规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在整理时遇到问题.我想设置排序规则以支持日语.例如,当table.firstname具有あ"时,带有ぁ"的查询应返回记录.预先感谢.

I am having a problem with collation. I want to set collation to support the Japanese language. For example, when table.firstname has 'あ', a query with 'ぁ' should return the record. Thanks in advance.

推荐答案

就像大写"和小写"一样,对吗?

That's like "uppercase" and "lowercase", correct?

mysql> SELECT 'あ' = 'ぁ' COLLATE utf8_general_ci;
+---------------------------------------+
| 'あ' = 'ぁ' COLLATE utf8_general_ci   |
+---------------------------------------+
|                                     0 |
+---------------------------------------+

mysql> SELECT 'あ' = 'ぁ' COLLATE utf8_unicode_ci;
+---------------------------------------+
| 'あ' = 'ぁ' COLLATE utf8_unicode_ci   |
+---------------------------------------+
|                                     1 |
+---------------------------------------+

mysql> SELECT 'あ' = 'ぁ' COLLATE utf8_unicode_520_ci;
+-------------------------------------------+
| 'あ' = 'ぁ' COLLATE utf8_unicode_520_ci   |
+-------------------------------------------+
|                                         1 |
+-------------------------------------------+

我建议将您的列更改为COLLATION utf8_unicode_520_ci(或utf8mb4_unicode_520_ci).

I recommend changing your column to be COLLATION utf8_unicode_520_ci (or utf8mb4_unicode_520_ci).

如果希望包含中文,请确保使用utf8mb4. (也许此建议也适用于汉字.)

If you expect to be including Chinese, then be sure to use utf8mb4. (Perhaps this advice applies to Kanji, too.)

这篇关于如何在日语版的MySQL中设置架构排序规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆