MySQL-查询表,视图,触发器,函数,存储过程

1、查询数据库中的存储过程和函数
select `name` from mysql.proc where db = 'ecc' and `type` = 'PROCEDURE';
select `name` from mysql.proc where db = 'ecc' and `type` = 'FUNCTION';

2、查询存储过程、函数状态
show procedure status;
show function status;  

3、mysql查询所有表数量:
SELECT count(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ecc' AND  TABLE_TYPE ='BASE TABLE';

4、mysql查询建表语句:
show create table `address` ;

5、mysql查询所有视图:
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ecc' AND  TABLE_TYPE ='VIEW';

6、mysql查询视图创建语句:
show create view `视图名` ;

7、mysql查询所有触发器:
SELECT * FROM information_schema.`TRIGGERS`;

8、mysql查询触发器定义语句:
select * from information_schema.triggers where TRIGGER_NAME='触发器名';

9、mysql查询函数定义语句:
SHOW CREATE FUNCTION `函数名`;

10、mysql查询procedure定义语句:
SHOW CREATE procedure `存储过程名`;

posted @ 2022-03-17 09:29  深海蓝精灵  阅读(348)  评论(0编辑  收藏  举报