Is it possible to have a table with round integrity reference keys? In the example, if I had a table namedContainer
ObjectId ParentId
1 1
2 1
3 2
ObjectId 1 refers to itself. Identifiers 2 and 3 refer to their respective parents, which are also in the same table. It would be impossible to delete 3 without deleting 2, 2 without deleting 1, and it would be impossible to delete 1.
I know I could do the same with a cross-reference table like
ObjectId ContainerId
1 1
2 2
3 3
ContainerId ObjectId
1 1
2 1
3 3
But I'm interested in the first way to achieve more, as it will eliminate the possibly unnecessary table. Is it possible?
source
share