Home > Database > Mysql Tutorial > body text

How to check the character set and column names of all tables in a specific MySQL database?

PHPz
Release: 2023-08-26 11:13:16
forward
898 people have browsed it

如何检查特定 MySQL 数据库中所有表的字符集以及列名?

With the help of the following MySQL query, we can check the character set of all tables in a specific database -

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

Example

For example, the following query returns the name The character set and column names of all tables in the database that are "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)
Copy after login

The above is the detailed content of How to check the character set and column names of all tables in a specific MySQL database?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!