Quantcast
Channel: Database Design forum
Viewing all articles
Browse latest Browse all 2729

How would I establish a relationship with duplicates of the same source and topic to the correct comment in a comment table?

$
0
0

I don't know if my title question is correct but I'm mentally stuck on how to establish a table relationship that pulls the correct data in a "many" table, back to the correct one relationship when there are multiple "Many" tables back to that single "One" table? I think I may simply need a table that has multiple "Many" table IDs in one associated table  -- but I'm not sure if that is the correct approach. So let me give an illustration of the issue:

The database is currently setup up as the design below. In the GUI sample image below, a user can select a topic, click "Search" and this design will correctly pull the related sources associated to that topic. However, here is where I notice my problem:

The PROBLEM:

After the app returns all the sources related to a topic, I want the user to be able to click on a source within the results and display the associated Comments, Quote, Term.However, since a source may have multiple comments for the same topic and Source combination, this is where my design breaks down and I'm not sure how I establish this relationship to retrieve the correct Comment, Quote and Term, which were all optional fields at the time of entry.

I could, and probably should, include snippet of the comment in the retrieved results, however, that still presents me the same problem. How would I establish a relationship with duplicates of the same source and topic to the correct comment?

I was thinking that during the entry of that specific note, I would capture all the associated PKs for the Source, Topic, Comment, Quote, Term, and add them to an "IDs" table that establishes that relationship specifically. But I don't know if that would be correct or if there is a better, more logical way.



SV



Viewing all articles
Browse latest Browse all 2729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>