How can I check the character set of all the tables along with column names in a particular MySQL database?


With the help of the following MySQL query we can check the character sets of all the tables in a particular database −

mysql> Select Column_name, TABLE_NAME, CHARACTER_SET_NAME FROM
       INFORMATION_SCHEMA.Columns Where TABLE_SCHEMA = 'db_name';

Example

For example, the query below returns the character sets of all the tables along with the column names in a database named ‘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)

Updated on: 20-Jun-2020

97 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements