Hi there,
Please could you help me to build my database structure ?
I would like to create an app in which users can leave comments associated with items from different tables.
For example, there would be several tables: Movies, Books, Characters. Users could comment multiple times on each item in these tables.
Regarding the data structure, I was thinking of two solutions:
-
A single “Comments” table that references the different tables. But in this case, I don’t understand how to use the “ispartof” function. Indeed if I delete an element, I would like the associated comments to be deleted as well so as not to keep data unnecessarily.
-
Create several comment tables for each element (Comments_Movies, Comments_Books, etc). But in this case, will I be able to create a view that displays all the comments from these different tables?
Or is it a mixture of these two solutions with a main table containing all the comments and an intermediate table created separately for each type of item ?
Sorry if this is a basic question regarding data structure, I’m a newbie.