I am making a small program where users makes posts or write blogs. On those posts, other users can like or dislike the post as in facebook or upvote or downvote the post as in stackoverflow. I would like to know a good database structure which is commonly used & the program works efficiently with that structure. I have two options
id head message datepost likes dislikes 1 ab anchdg DATE 1,2,3 7,55,44,3
In the above way,
id is the postid. In the likes column,
1,2,3 is the user's id who liked or upvoted the post or blog.
7,55,44,3 is the id of the users who disliked or downvoted the post or blog.
id head message datepost 1 ab anchdg DATE
id postid userid 1 1 1 2 2 2
id postid userid 1 1 7 2 1 55
In this way, I have to create two separate tables for likes & dislikes to get post's likes. In this way, the tables i.e.
Dislikes will get heavily filled. This might make table heavy & processing slow.
So, I would like to know which is the better & standard way to achieve this task?