I have the following problem that I want to solve. I want to add a column of IDs, which should connect one comment to one of the tables above, e.g. Videos. I don't want to add a CommentID column to the tables above, since each of the tables could have multiple comments.
Idea 1: I know that the database, can also be designed as the following with joins in the query. The query would look something like that: SELECT * FROM Comments c JOIN Videos_Comments vc ON c.CommentID=vc.CommentID JOIN Videos v ON vc.VideoID=v.VideoID ...
Idea 2: Another idea, would be to prefix the IDs of each table e.g. V12
.
Is there another more approved way of implementing it?
Tl;dr: How can I accomplish having IDs of different tables in the same column and at same time beeing able to preserve the origin of the ID.