Mysql怎么查看字段的属性值

 2982

mysql查看字段属性值的方法:1、查询数据库中某个库所有字段的属性【table_schema= '数据库库名'】;2、查询数据库中指定库指定表所有字段的属性【table_schema= '数据库库名' and table_name= 】。


Mysql怎么查看字段的属性值


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= '数据库库名'

table_schema:数据库库名

table_name:表名

column_name:字段名

column_type:字段属性(包含字段类型和长度)

column_comment :字段注释(字段说明)

data_type:字段类型

column_key:字段的主键(PRI为主键)

is_nullable:字段是否为空



TAG标签:
本文网址:https://www.zztuku.com/detail-7969.html
站长图库 - Mysql怎么查看字段的属性值
申明:如有侵犯,请 联系我们 删除。

评论(0)条

您还没有登录,请 登录 后发表评论!

提示:请勿发布广告垃圾评论,否则封号处理!!

    编辑推荐

    iPhone X样机PSD模型素材