Last active
August 29, 2015 13:57
-
-
Save nisar1/9426905 to your computer and use it in GitHub Desktop.
defination of database objects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Lists sp,tbl,fn in a dbz | |
--show procedure | |
SHOW PROCEDURE STATUS WHERE Db = DATABASE() AND TYPE = 'PROCEDURE'; | |
SHOW FUNCTION STATUS WHERE Db = DATABASE() ; | |
select name from mysql.proc where db = database(); | |
--list keys | |
select * | |
from INFORMATION_SCHEMA.TABLE_CONSTRAINTS | |
where CONSTRAINT_TYPE = 'FOREIGN KEY' | |
-- show create statement | |
SHOW CREATE PROCEDURE procedurename ; | |
SHOW CREATE TABLE tablename; | |
SHOW TABLE STATUS ; | |
-- get column details | |
DESCRIBE 'table name' ; | |
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'table_name' and table_schema = 'database' ; | |
SHOW COLUMNS FROM table_name ; | |
-- get table details | |
SELECT table_name FROM information_schema.tables WHERE table_schema = 'db_sanitary2' ; | |
------- | |
show databases; | |
show tables; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment