如何检查特定MySQL数据库中所有表的字符集以及列名?
借助以下MySQL查询,我们可以检查特定数据库中所有表的字符集-
mysql> Select Column_name, TABLE_NAME, CHARACTER_SET_NAME FROMINFORMATION_SCHEMA.Columns Where TABLE_SCHEMA = 'db_name';
示例
例如,下面的查询返回所有表的字符集以及名为“ Alpha”的数据库中的列名。
mysql> Select Column_name 'Column',TABLE_NAME, CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.Columns Where TABLE_SCHEMA = 'Alpha';+---------+------------+--------------------+
| Column | TABLE_NAME | CHARACTER_SET_NAME |
+---------+------------+--------------------+
| Name | employee | latin1 |
| email | employee | latin1 |
| Name | student | latin1 |
| RollNo | student | NULL |
| Address | student | latin1 |
+---------+------------+--------------------+
5 rows in set (0.04 sec)
以上是 如何检查特定MySQL数据库中所有表的字符集以及列名? 的全部内容, 来源链接: utcz.com/z/316845.html