Showing posts with label mysql constraint. Show all posts
Showing posts with label mysql constraint. Show all posts

Friday, September 23, 2016

MySQL list all foreign key and other constraint names


SELECT  TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME, 
        REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME

FROM    INFORMATION_SCHEMA.KEY_COLUMN_USAGE

WHERE   REFERENCED_TABLE_SCHEMA = 'database_name'