Let’s say I have the following DB schema (Which I am open to change by the way)
likesRel(relationShip to Likes 1:many)
commentsRel(relatiohsip to Comments 1:1)
I assume that I don’t need to add PK and FK across the tables because this is what the concept of relationships are.
The above bascially shows you users who made likes on comments.
Now based on the above, I need the following:
- Given user Id, get likes and the comments being liked.
- Give me all the likes and comments of all the users whose age is less than 25
- for a specific comment, get me all the users who liked it
How do you advise handling this?