I won't say much nonsense, let's just look at the code~ -- View and obtain the field comments in the table: show full columns from tablename; -- Or show full fields from tablename; -- Or, look in the metadata table Select COLUMN_NAME column name, DATA_TYPE field type, COLUMN_COMMENT field comment from INFORMATION_SCHEMA.COLUMNS Where table_name = 'companies'##table name AND table_schema = 'testhuicard'##database name AND column_name LIKE 'c_name'##field name -- 2-1 How to view table comments: show create table tablename; -- 2-2 Get all table information of the entire database (including table name, table comment, table type, etc.): SELECT table_name, table_type, engine FROM information_schema.tables WHERE table_schema = 'db5' //table_schema is the database name ORDER BY table_name DESC; -- This statement requests a reverse alphabetical listing of all tables in database db5, but only displays three types of information: table name, table type, and table engine. -- INFORMATION_SCHEMA is the information database that holds information about all other databases maintained by the MySQL server. SELECT TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'sh_goods' AND TABLE_SCHEMA = 'sh_shop'; //Get the comments of the sh_goods table in the sh_shop database. -- 2-3 Get table comments or -- or use: show table status; -- Comment is a table comment. -- Extensions: -- Modify the table's comments: alter table test1 comment 'Comments of the modified table'; -- Modify the field's comment: alter table test1 modify column field_name int comment 'modified field comment'; Supplement: mysql query all field names, field types and comments of a table in a database When doing background development, we must generate corresponding entity classes, that is, JavaBeans, from the tables in the data. During development, in order to quickly generate entity classes, we can query all field names, field types and comments of a table in the database, and quickly create JavaBeans, which can also prevent spelling errors. Corresponds one to one with the fields in the database. In Navicat (database visualization tool), you can execute SQL statements select COLUMN_NAME,DATA_TYPE,COLUMN_COMMENT from information_schema.COLUMNS where table_name = 'table name' and table_schema = 'database name'; The result is similar to: The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. If there are any mistakes or incomplete considerations, please feel free to correct me. You may also be interested in:
|
<<: How to use VUE to call Ali Iconfont library online
>>: HTML table tag tutorial (20): row background color attribute BGCOLOR
Table of contents 1. Detailed syntax of entires()...
1. Download and install Download the community ed...
HTML imitates the Baidu Encyclopedia navigation d...
This article uses examples to describe how to use...
Getting Started with JavaScript JavaScript is a l...
Use javascript to implement a fixed sidebar, for ...
This article shares the specific code for impleme...
Considering that many people now use smartphones, ...
Quoting Baidu's explanation of pseudo-static:...
I have been learning about responsive design rece...
Tomcat defines multiple ClassLoaders internally s...
Recently, when I was working on a front-end vue.j...
Table of contents Native JS How to send a get req...
CSS3 implements 2D plane transformation and visua...
Table of contents Written in front Environment de...