I am developing a simple blog application in which users can write posts and others can like, comment, share etc. i am facing difficulty in designing database.
What I have tried is:
user (user_id(pk), user_name)
post (post_id(pk), post_content, likes, user_id(fk))
comment(comment_id(pk), comment, post_id(fk))
PROBLEM: One user can have many posts and many users can like and comment on many posts. Whether I have to separate two tables like: user
, post
and userpost
?
Can anyone tell me if anything wrong in this design?
Best Answer
Try something like this
In
status
column inlikes
table you can save it aslike
orunlike
can be tinyint field with