mysql:13840
From: YuGo <YuGo <yu.gotou@xxxxxxxxxx>>
Date: Wed, 28 Mar 2007 08:49:48 +0900
Subject: [mysql 13840] Re: utf-8 での日本語ソート
佐々木どの。
参考までにわたしの使っているMySQLではこう並びます。
実行したsql
mysql>CREATE TABLE collation_test ( id int PRIMARY KEY AUTO_INCREMENT,
string character varying(2));
mysql>INSERT INTO collation_test (string) VALUES
('0'),('1'),('2'),('a'),('b'),('c'),('0'),('1'),('2'),('N'),('Q'),
('あ'),('い'),('ん'),('イ'),('出'),('塁'),('新'),('[');
mysql>SELECT * FROM collation_test ORDER BY string ASC ;
0 1 2 a b c [ あ い ん イ 出 塁 新 0 1 2 N Q
環境
MySQL version 5.0.27-community-nt
OS WinXP SP2
collation utf8_general_ci
>
> YuGo様、市川様ご回答ありがとうございます。
> ご返事が遅れ誠に申し訳ありません。
>
> >>YuGo様
>
> ○utf8-genaral_ci
>
> 以下のSQLの結果
> mysql>SHOW VARIABLES LIKE 'collation%' ;
>
> utf8-genaral_ciとなっております。
> +----------------------+-----------------+
> | Variable_name | Value |
> +----------------------+-----------------+
> | collation_connection | utf8_general_ci |
> | collation_database | utf8_general_ci |
> | collation_server | utf8_general_ci |
> +----------------------+-----------------+
>
> ○ソートした結果
>
> 次の文字を一文字づつカラムに格納し、昇順でソートしました。
>
> 半角数 0 1 2
> 半角英 a b c
> 全角数 0 1 2
> 全角英 N Q
> ひらがな あ い ん
> カタカナ イ
> 漢字 出塁新
> 記号 [
>
> [ 結果 ]
>
> 012aあい塁イん出bc012NQ[新
>
> >市川様
>
> 漢字が入るとまずいのでしょうか?
> 漢字は含まれますが数字、英語、日本語(ひらかな)、記号、漢字がそれぞれ
> 分離されていれば漢字を50音順で並べるという無茶を言うつもりはありません。
>
> また、collationはどのようにして設定するのでしょうか。
> SQL文のorder byに追加するようにして使用するのでしょうか。
> (検索したのですが見つからなかったもので。)
>
> --------------------------------------------
> sasaki namabu
> sa9lovex@xxxxxxxxxx
>
>
>
> ---------------------------------
> [10th Anniversary] Check Out the Special Final Sale
>
@ 13825 2007-03-26 16:29 [nic sak <sa9lovex@xx] utf-8 での日本語ソート 13828 2007-03-26 17:11 ┣[YuGo <yu.gotou@xxxxx] 13829 2007-03-26 17:38 ┗[ICHIKAWA SHIN <sichi] @ 13835 2007-03-27 20:57 ┗[nic sak <sa9lovex@xx] -> 13840 2007-03-28 08:49 ┗[YuGo <yu.gotou@xxxxx] @ 13851 2007-03-30 16:14 ┗[nic sak <sa9lovex@xx]