Here's a simple query for displaying all foreign keys and their references in a MySQL DB:
select concat(table_name, '.', column_name) as 'foreign key', concat(referenced_table_name, '.', referenced_column_name) as 'references' from information_schema.key_column_usage where referenced_table_name is not null;
No comments:
Post a Comment