#mysql#常用系统表①

#查看所有数据库 show databases
select * from information_schema.SCHEMATA
#查看数据库中所有表(包含视图) show tables
#我经常会用到的是查对象创建时间(Create_TIME),以及自增长数(AUTO_INCREMENT),目前有多少条数据(Table_rows)
select * from information_schema.TABLES where Table_schema='DBName'
#查看所有列 show columns from eemployee
#会用于查列的数据类型,约束等属性
select * from information_schema.COLUMNS where Table_schema='DBName' and table_name='eemployee'
#查看所有索引,show index from eemployee
select * from information_schema.STATISTICS where Table_schema='DBName' and table_name='eemployee'
#查看表的约束
select * from information_schema.TABLE_CONSTRAINTS where Table_schema='DBName' and table_name='eemployee'
#查看表的所有有约束的列
select * from information_schema.KEY_COLUMN_USAGE where Table_schema='DBName' and table_name='eemployee'
#查看所有视图
#经常用到的是查看视图的定义 show create view 视图名
select * from information_schema.VIEWS where Table_schema='DBName'
#查看触发器 ,可看触发类型(insert,update,delete),创建时间等
select * from information_schema.TRIGGERS
#查看自定义函数和存储过程
#函数可以看到返回值类型(Data_TYPE),查看定义(Routine_definition),创建时间(Created),最后一次修改时间(Last_Altered)
select * from information_schema.ROUTINES where routine_schema='DBName' and routine_Type in('FUNCTION','PROCEDURE')

 

posted @ 2021-12-27 20:14  愿闻其详。  阅读(207)  评论(0)    收藏  举报