mysql 查詢表,檢視,觸發器,函式,儲存過程
阿新 • • 發佈:2018-11-22
轉載自 http://www.cnblogs.com/sx2zx/p/6245887.html
-1. mysql查詢所有表:
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = '資料庫名' AND TABLE_TYPE ='BASE TABLE'
mysql查詢建表語句:
show create table '表名'
-2.mysql查詢所有檢視:
` SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ‘資料庫名’ AND TABLE_TYPE =’VIEW’
mysql查詢檢視建立語句:
-3.mysql查詢所有函式:
SELECT name from mysql.proc where db= 'ifms' and type='function'
函式名
mysql查詢函式定義語句:
SHOW CREATE FUNCTION
-4.mysql查詢所有儲存過程:
SELECT name from mysql.proc where db= 'ifms' and type='procedure'
儲存過程名
mysql查詢procedure定義語句:
SHOW CREATE procedure
-5.mysql查詢所有觸發器:
SELECT * FROM information_schema.
mysql查詢觸發器定義語句:
select * from information_schema.triggers where TRIGGER_NAME='觸發器名';