共計(jì) 999 個字符,預(yù)計(jì)需要花費(fèi) 3 分鐘才能閱讀完成。
自動寫代碼機(jī)器人,免費(fèi)開通
這篇文章將為大家詳細(xì)講解有關(guān) mysql 查看字段屬性值的方法,丸趣 TV 小編覺得挺實(shí)用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
mysql 查看字段屬性值的方法:1、查詢數(shù)據(jù)庫中某個庫所有字段的屬性【table_schema= 數(shù)據(jù)庫庫名】;2、查詢數(shù)據(jù)庫中指定庫指定表所有字段的屬性【table_schema= 數(shù)據(jù)庫庫名 and table_name=】。
mysql 查看字段屬性值的方法:
1、查詢數(shù)據(jù)庫中某個庫所有字段的屬性(指定數(shù)據(jù)庫庫名),若想查詢所有去掉 where 條件即可
select * from information_schema.columns
where table_schema= 數(shù)據(jù)庫庫名
2、查詢數(shù)據(jù)庫中指定庫指定表所有字段的屬性(指定數(shù)據(jù)庫庫名和表名)
select * from information_schema.columns
where table_schema= 數(shù)據(jù)庫庫名
and table_name = 表名
3、查詢數(shù)據(jù)庫中特定列條件為某個字段名的屬性
select table_schema,table_name,column_name,column_type,column_comment
from information_schema.columns
where TABLE_SCHEMA= 數(shù)據(jù)庫名 and column_name = 字段名
4、查詢數(shù)據(jù)庫中特定列(如:字段名、字段類型,長度大小、字段注釋等)
select table_schema,table_name,column_name,column_type,column_comment from information_schema.columns
where table_schema= 數(shù)據(jù)庫庫名
table_schema:數(shù)據(jù)庫庫名
table_name:表名
column_name:字段名
column_type:字段屬性(包含字段類型和長度)
column_comment:字段注釋(字段說明)
data_type:字段類型
column_key:字段的主鍵(PRI 為主鍵)
is_nullable:字段是否為空
關(guān)于 mysql 查看字段屬性值的方法就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,可以學(xué)到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
向 AI 問一下細(xì)節(jié)
丸趣 TV 網(wǎng) – 提供最優(yōu)質(zhì)的資源集合!