I want to make a relationship between two Tags entities, but I don't like the typical way it is handled in the RDBMS databases.
Like here: https://stackoverflow.com/a/35784048/1624397
INSERT INTO RECOMMENDED_BOOKS (Book_id1, Book_id2) VALUES (1, 2)
INSERT INTO RECOMMENDED_BOOKS (Book_id1, Book_id2) VALUES (1, 3)
Book_id1, Book_id2...
Or another "bad" example I'm looking for an alternative to (which makes sense in this case, anyway):
Self-referencing to a User friendsWithMe
and myFriends
.
If I do something like tag_id1
and tag_id2
I either will be forced to search for whether there is a relation between both twice, or be forced to keep redundant data.
Is there any alternative solution?
Preferably the solution was storage-agnostic.