开发者

How can I sort non-English strings in MySQL?

开发者 https://www.devze.com 2023-03-19 11:33 出处:网络
CREATE TABLE IF NOT EXISTS `gujarati` ( `name` varchar(20) CHARACTER S开发者_运维百科ET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
CREATE TABLE IF NOT EXISTS `gujarati` (
  `name` varchar(20) CHARACTER S开发者_运维百科ET utf8 COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `gujarati` (`name`) VALUES
('ક'),
('દિનેશ'),
('ખા'),
('ગા'),
('થા'),
('થ'),
('કા'),
('મયૂર'),
('છત્ર'),
('ત્ર'),
('ક્ષ'),
('તા'),
('એક'),
('બોલ્ડ'),
('જ'),
('ટી'),
('મી'),
('હા'),
('યા'),
('ના'),
('ધી'),
('સો'),
('લા'),
('ઝા'),
('ણ્ણા');

This is my table that stores the Gujarati language. How can I sort this data in a MySQL database?


Set the gujarati's table collation to the one coresponding to this language, then simply sort with ORDER BY - it's supposed to work out of the box


Please use this meta tag :

meta http-equiv="Content-Type" content="text/html; charset=UTF-8" 

And use this code in php :

mysql_query ("set character_set_results='utf8'");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号