mysql如何订购文本数据?

时间:2013-09-29 02:42:21

标签: python mysql

这是一些文章数据集的查询结果,这些文章按文章标题升序排序,在MySQL中限制为10。编码设置为utf8_unicode_ci。

'GTA 5' Sells $800 Million In One Day
'Infinity Blade III' hits the App Store ahead of i...
‘Have you lurked her texts?’ How the directors of ...
‘Second Moon’ by Katie Paterson now on a journey a...
"Do not track" effort in trouble as Digital Advert...
"Forbes": Bill Gates wciąż najbogatszym obywatelem...
"Here Is Something False: You Only Live Once"
“That's The Dumbest Thing I've Ever Heard Of.”
[Introduction to Special Issue] The Future Is Now
1 Great Dividend You Can Buy Right Now

我认为通过在编码表中获取字符的位置来进行排序。 类似于' is 39" is 34的unicode,但撇号ʼ和双引号的位置要高得多。根据我的理解ʼ“不应该将其纳入结果,而"应该位于顶部。我在这里显然遗漏了一些东西。

我的目标是在python中按标题排序这些数据,以获得与在mysql中排序数据相同的结果。

1 个答案:

答案 0 :(得分:1)

它的要点是,为了获得更好的排序顺序,使用了Unicode排序算法,它可能(可能)将转换为"转换为{{1排序时。

不幸的是,在Python中模拟并不简单,因为算法并不重要。您可以寻找像'这样的包装器库来完成这项艰苦的工作,尽管我不能保证它们能够正常工作。