What can be the possible query for listing all/one the table(s) that are being referenced from a given table please?
Actually I can list the tables which are referenced by a given table with the following query I found on search.
use INFORMATION_SCHEMA;
select TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME,
REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME from KEY_COLUMN_USAGE where
REFERENCED_TABLE_NAME = '<table>';
But what I need is the reverse side of this. That is a list of tables that are being referenced from a given table.
Would be great to have a solution.. Thanks in advance.
You can use:
To check which tables link to ‘yourtable’.
You can use:
to search the other way around. Make sure to use correct foreign key declaration in the create table statement in order for this table to be filled correctly!