I am trying to design a database for my application and I am struggling with something.
I need to store a Collection:
As you can see, the Collection has an ID and a date, easy so far. (Please ignore the analysisID)
The problem is the target, which is a bit tricky. A Collection can have two different types of targets (let's say, a book or a magazine - mutually exclusive), both having IDs that could, eventually, coincide, as they are in two different tables. What would be a good approach for this? I thought about creating two different foreign keys (one for book and the other for magazine), and one of them would always be NULL, which I think is far from the best approach.
Sorry if something was unclear, if you have any doubts, please just ask :)
Thanks!