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

MySQLMySQLi Database

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)
raja
Published on 19-Feb-2018 12:35:34
Advertisements