Mysql method to view field attribute values: 1. Query the attributes of all fields in a certain library in the database [table_schema= 'database library name']; 2. Query the attributes of all fields in the specified table in the specified library in the database [ table_schema= 'database name' and table_name= ].
Mysql method to view field attribute values:
1. Query the attributes of all fields in a library in the database (Specify the database name), if you want to query all, just remove the where condition
select * from information_schema.columns where table_schema= '数据库库名'
2. Query the attributes of all fields of the specified table in the specified library in the database (specify the database name and table name)
select * from information_schema.columns where table_schema= '数据库库名' and table_name = '表名'
3. Query the attributes of specific columns in the database whose condition is a certain field name
select table_schema,table_name,column_name,column_type,column_comment from information_schema.columns where TABLE_SCHEMA='数据库名' and column_name = '字段名';
4. Query specific columns in the database (such as field name, field type, length, field comments, etc.)
select table_schema,table_name,column_name,column_type,column_comment from information_schema.columns where table_schema= '数据库库名'
table_schema: Database library name
table_name: Table name
column_name: Field name
column_type: Field attributes (including field type and length)
column_comment: Field comments (field description)
data_type: Field type
column_key: Primary key of the field (PRI is the primary key)
is_nullable: Whether the field is empty
More related free learning recommendations:mysql tutorial(Video)
The above is the detailed content of How to check the attribute value of a field in mysql. For more information, please follow other related articles on the PHP Chinese website!