Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to query all tables and comments by mysql

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Today, I would like to share with you how mysql queries all tables and comments about the relevant knowledge points, detailed content, clear logic, I believe that most people still know too much about this knowledge, so share this article for your reference, I hope you can learn something after reading this article, let's take a look at it.

In mysql, you can query all tables and comments using the statement "select TABLE_NAME,TABLE_COMMENT from INFORMATION_SCHEMA.Tables where table_schema = 'database name'".

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

How does mysql query all tables and comments

To view the table names and table comments of all tables under the Mysql database, the syntax is as follows:

SELECT TABLE_NAME table name, TABLE_COMMENT table comment FROM information_schema.tablesWHERE TABLE_SCHEMA = 'database name' ORDER BY TABLE_NAME

Expand knowledge:

1. View the table names, table comments and data volume of all tables under the Mysql database "ori_data".

SELECT TABLE_NAME table name, TABLE_COMMENT table comments, TABLE_ROWS data volume FROM information_schema.tablesWHERE TABLE_SCHEMA = 'ori_data' ORDER BY TABLE_NAME

two。 Query database 'ori_data' Table' accumulation' all field comments

SELECT COLUMN_NAME field name, column_comment field comment FROM INFORMATION_SCHEMA.Columns WHERE table_name='accumulation' AND table_schema='ori_data'

3. Query table names, table comments, and corresponding table field comments for all tables under the database "ori_data"

SELECT a.TABLE_NAME table name, a.TABLE_COMMENT table comment, b.COLUMN_NAME table field, b.COLUMN_TYPE field type, b.COLUMN_COMMENT field annotation FROM information_schema.TABLES a direction SCHEMA.Columns b WHERE b.TABLE_NAME=a.TABLE_NAME AND a.TABLESCHEMAThe annotations are all the contents of the article "how to query all tables and comments in mysql". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report