Home  >  Article  >  Database  >  What is the query to check the character set of a MySQL table column?

What is the query to check the character set of a MySQL table column?

WBOY
WBOYforward
2023-09-22 08:05:28691browse

What is the query to check the character set of a MySQL table column?

The following is a query to check the character set of a MySQL table column -

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 following query returns a query named "sample" The column names of the "test_char_set" table in the database and the character sets for these 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)

The above is the detailed content of What is the query to check the character set of a MySQL table column?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete