发现MySQL列的排序规则 [英] Discover collation of a MySQL column
本文介绍了发现MySQL列的排序规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我以前创建了一个MySQL表,现在我想找出某些字段正在使用的排序规则.我可以使用哪些SQL或MySQL命令来发现这一点?
I previously created a MySQL table and now I want to find out what collation some of the fields are using. What SQL or MySQL commands can I use to discover this?
推荐答案
您可以使用SHOW FULL COLUMNS FROM tablename
,它返回列归类,例如,对于表"accounts"具有特殊归类的表列名称"
You could use SHOW FULL COLUMNS FROM tablename
which returns a column Collation, for example for a table 'accounts' with a special collation on the column 'name'
mysql> SHOW FULL COLUMNS FROM accounts;
+----------+--------------+-------------------+------+-----+---------+----------+
| Field | Type | Collation | Null | Key | Default | Extra |
+----------+--------------+-------------------+------+-----+---------+----------|
| id | int(11) | NULL | NO | PRI | NULL | auto_inc |
| name | varchar(255) | utf8_bin | YES | | NULL | |
| email | varchar(255) | latin1_swedish_ci | YES | | NULL | |
...
或者您可以使用SHOW CREATE TABLE tablename
这将导致类似
Or you could use SHOW CREATE TABLE tablename
which will result in a statement like
mysql> SHOW CREATE TABLE accounts;
CREATE TABLE `accounts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
...
这篇关于发现MySQL列的排序规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文