I'm trying to design a database architecture for a simple inventory program.
This inventory will consist of items in boxes. Boxes contain items, and are items themselves.
I imagine box
will be a super type of item
.
My main hangup is how to structure/constrain the relation between boxes so that I can still constrain the unique condition that an item can only be in one "place" at a time.
I know that many-to-many relations should let me know which items are in which boxes, but what about boxes that are in other boxes?
For instance:
Box A
contains Item B
and Box C
. Box C
contains Item D
.
How can I design a system that when I look for Item D
I will find it inside Box A
and Box C
(really great if I could also know how the relation of the boxes -- latter is inside the former).