I have 3 tables:
Books (BookId PK, ...)
Posts (PostId PK, ...)
Users (UserId PK, ...)
And I need to create Reviews for all of them. Should I use a table Reviews:
Reviews (ReviewId PK, BookId FK, PostId FK, UserId FK)
And than with a Check Constrain make sure that only one of BookId
, PostId
or UserId
is not NULL?
Or is a better way to do this?