Last active
August 29, 2015 14:04
-
-
Save faloi/2218b1c98fcc40fff4d4 to your computer and use it in GitHub Desktop.
This file contains 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
-- Foreign keys | |
use INFORMATION_SCHEMA; | |
select constraint_name, TABLE_NAME, REFERENCED_TABLE_NAME | |
from KEY_COLUMN_USAGE | |
where REFERENCED_TABLE_NAME is not null | |
-- Count of foreign keys with "FK_" prefix | |
use INFORMATION_SCHEMA; | |
select count(*) | |
from KEY_COLUMN_USAGE | |
where INSTR(constraint_name, 'FK_') > 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment