mysql 實用操作表屬性 數據庫屬性 等

mysql:

select:

select * from information_schema.Columns where table_name='表名

#查詢表的各個屬性


select column_comment,column_name,data_type,is_nullable,column_type,numeric_precision,numeric_scale ,column_default from information_schema.Columns where table_name='表名

#查詢表的 字段名字,字段註釋 , 數據類型 ,是否可以爲空 ,字段類型,數值精度,小數點數, 列morenzhi


select * from information_schema.tables 

查詢表信息


select table_name,table_comment from information_schema.tables 

查詢表  表名 ,表註釋


select table_name,table_comment from information_schema.tables where table_name like '%表名%'

模糊匹配相應的表


SELECT count(*) TABLES, table_schema FROM information_schema.TABLES  where table_schema = '表名' GROUP BY table_schema;

查詢數據庫表總數量


edite:

alter table 表明  add  字段名   decimal(18,2)

給表增加一個字段
alter table 表明  
drop column 字段名

刪除表的一個字段

alter table 表名 modify  字段名 decimal(18,2) 

修改表的一個字段

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章