Home > Blockchain >  How Can I Avoid Sql Circular Reference In This Instance?
How Can I Avoid Sql Circular Reference In This Instance?

Time:10-30

I have a simple app and in this app there are 2 roles. Role 1 is a Buyer and Role 2 is a Seller. A seller can setup a post to list an item for sale. A buyer can bid on the item in a post the seller posted.

I've been thinking of a way to prevent circular reference here but I think I am over thinking it or missing another path. What would be the best way to configure this setup?

enter image description here

CodePudding user response:

There is actually no circular reference to worry about here. BuyerBids and SellerPosts are fact tables (where the second has details about the first), and MarketUsers is a dimension table.

The many-to-one relations are toward the dimension table, as is expected.

There is no cycle where you would follow relations from the many side to the one side via many-to-one. For example if you start in SellerPosts you have a many-to-one to BuyerBids and from there to MarketUsers, but from there we don't have an outgoing many-to-one relation linking back to where we started.

In other words, if the graph formed by many-to-one relations (as directed edges) is a directed acyclic graph (which it is, in this case), the model is not circular.

  • Related