对于MySQL中的数据类型INT,哪种排序最佳?

时间:2021-09-07 16:56:51

When a filed is INT(data type), what should I choose as collation in MySQL?

当一个字段是INT(数据类型)时,我应该选择什么作为MySQL中的排序规则?

2 个解决方案

#1


17  

Collation affects string sorting. It doesn't have any effect on numeric data types.

归类会影响字符串排序。它对数字数据类型没有任何影响。

It may, howevever, have an effect on how numbers embedded in strings are sorted. But that's still no effect on numeric data types such as INT.

但是,它可能会影响字符串中嵌入的数字的排序方式。但这对INT等数字数据类型仍然没有影响。

#2


4  

As far as I know, you can specify a collation (or a character set for that matter) only for string types, ie. the types VARCHAR, CHAR, ENUM, SET, and TEXT types (TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT)

据我所知,您可以仅为字符串类型指定排序规则(或该字符集),即。 VARCHAR,CHAR,ENUM,SET和TEXT类型的类型(TINYTEXT,TEXT,MEDIUMTEXT,LONGTEXT)

#1


17  

Collation affects string sorting. It doesn't have any effect on numeric data types.

归类会影响字符串排序。它对数字数据类型没有任何影响。

It may, howevever, have an effect on how numbers embedded in strings are sorted. But that's still no effect on numeric data types such as INT.

但是,它可能会影响字符串中嵌入的数字的排序方式。但这对INT等数字数据类型仍然没有影响。

#2


4  

As far as I know, you can specify a collation (or a character set for that matter) only for string types, ie. the types VARCHAR, CHAR, ENUM, SET, and TEXT types (TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT)

据我所知,您可以仅为字符串类型指定排序规则(或该字符集),即。 VARCHAR,CHAR,ENUM,SET和TEXT类型的类型(TINYTEXT,TEXT,MEDIUMTEXT,LONGTEXT)