myMySQL数据库怎么查看字段的属性值 MySQL数据库使用教程

凤凰 2021-1-19 123 1/19

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

myMySQL数据库怎么查看字段的属性值 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:字段是否为空

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

以上就是mysql怎么查看字段的属性值的详细内容,更多请关注本站其它相关文章!

- THE END -

凤凰

1月19日09:36

最后修改:2021年1月19日
0

非特殊说明,本博所有文章均为博主原创。