Using Oracle, is there any way I can execute a query to d开发者_运维问答etermine what relationship a specific table has with any other tables in my database? I'm fiddling with the all_constraints table as of now.
Yes, you can do this for example:
select p.table_name, 'is parent of ' rel, c.table_name
from   user_constraints p
join   user_constraints c on c.r_constraint_name = p.constraint_name
                         and c.r_owner = p.owner
where p.table_name = 'MYTABLE'    
union all
select c.table_name, 'is child of ' rel, p.table_name
from   user_constraints p
join   user_constraints c on c.r_constraint_name = p.constraint_name
                         and c.r_owner = p.owner
where c.table_name = 'MYTABLE' 
I think your best bet is trying to extract as much information as you can from the foreign key constraints.
Have a look at this article at Database Journal that explains foreign key data mining in detail.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论