What is the query to check Character set of the columns of MySQL table?


Following is the query to check character set of the columns of MySQL table −

mysql> Select Column_name 'Column', Character_set_name 'Charset' FROM
       information_schema.columns where table_schema = 'db_name' and
       table_name ='table_name';

Example

For example, the query below returns the name of the columns of ‘test_char_set’ table in a database named ‘sample’ along with the character sets of those columns.

mysql> Select Column_name 'Column', Character_set_name 'Charset' FROM
       information_schema.columns where table_schema = 'Sample' and
       table_name ='test_char_set';

+--------+---------+
| Column | Charset |
+--------+---------+
| Name   | latin1  |
| Field  | latin1  |
+--------+---------+
2 rows in set (0.03 sec)

Updated on: 20-Jun-2020

345 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements