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=?'數據庫庫名'
-
table_schema:數據庫庫名
-
table_name:表名
-
column_name:字段名
-
column_type:字段屬性(包含字段類型和長度)
-
column_comment :字段注釋(字段說明)
-
data_type:字段類型
-
column_key:字段的主鍵(PRI為主鍵)
-
is_nullable:字段是否為空
更多相關免費學習推薦:mysql教程(視頻)
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END
喜歡就支持一下吧
相關推薦