贝利信息

mysql怎么查看字段的属性值

日期:2020-10-23 00:00 / 作者:coldplay.xixi
mysql查看字段属性值的方法:1、查询数据库中某个库所有字段的属性【table_schema= '数据库库名'】;2、查询数据库中指定库指定表所有字段的属性【table_schema= '数据库库名' and table_name= 】。

mysql查看字段属性值的方法:

1、查询数据库中某个库所有字段的属性(指定数据库库名),若想查询所有去掉where条件即可

select * from information_schema.columns 
where table_schema= '数据库库名'

2、查询数据库中指定库指定表所有字段的属性(指定数据库库名和表名)

select * from information_schema.columns 
where table_schema= '数据库库名' and table_name = '表名'

3、查询数据库中特定列条件为某个字段名的属性

select table_schema,table_name,column_name,column_type,column_comment 
from information_schema.columns 
where TABLE_SCHEMA='数据库名' and column_name = '字段名';

4、查询数据库中特定列(如:字段名、字段类型,长度大小、字段注释等)

select table_schema,table_name,column_name,column_type,column_comment from information_schema.columns 
where table_schema= '数据库库名'

更多相关免费学习推荐:mysql教程(视频)