mysql怎么查看字段的屬性值

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:字段是否為空

更多相關免費學習推薦:mysql教程(視頻)

以上就是

? 版權聲明
THE END
喜歡就支持一下吧
點贊9 分享