To see foreign key relationships of a table: SELECT TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA. KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = 'db_name' AND REFERENCED_TABLE_NAME = 'table_name';
Find data across a MySQL connection by using the text search feature on any number of tables and schemas. From the schema tree, select the tables, schemas, or both to search and then right-click the highlighted items and click Search Data Table from the context menu.
select table_name
from information_schema.KEY_COLUMN_USAGE
where table_schema = 'my_database'
and referenced_table_name = 'my_table_here';
This works.
select table_name
from information_schema.referential_constraints
where referenced_table_name = 'parent table here';
If you have phpMyAdmin installed, you can use its designer feature to visualize table relationships.
To use the designer, select a database, then look for the Designer tab.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With