How can I understand FK relationships in Entity and Entity_Attr?
Question

Given a certain table, I am trying to write a query that would return to me all of the other dependent tables that have a Foreign Key relationship to my table's primary key. I have been trying to accomplish this via Entity and Entity_Attr, but I am not understanding how the table relationship information is stored...

Can someone please help me?

Thanks,

----Erik

Solution

@Erik Bleifield : Not able to find any direct relationship between 2 entities which have foreign key relations. But one way which figured out is on the basis of "type" we can create a relation between 2 entities. 

I created 2 entities as below.

Entity_attr table :


From above data we can understand that "FirstId" field in second table has type  some string * ss_key of first entity. So we can write some logic on the basis of this relation.

Thanks Vikas - that is what I was looking for.

Thanks!

Yes. It seems the only way to find the relation.  Thanks.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.