在数据库中存储好恶[关闭]

Guys what is the best database model for storing user likes and dislikes? Is good approach to have separated table like below ?:

1. tbl_post_likes

2. tbl_post_dislikes

tbl_post_likes has:

id  |  post_id<fg>  | account_id<fg> | etc...

tbl_post_dislikes has:

id  |  post_id<fg>  | account_id<fg> | etc...

Or is better to all this put in one table? But i think one table is bad approach?

I need this for my blog posts where only registred user can to like and dislike post items. If user already liked only enable dislike and the some.

no, just need one table called

tbl_post_likes

in that table column like:

id | post_id | account_id | vote |

in like column it`s set flag 1 or 0.

1 stands for like

0 stands for dislike.

I hope that this is good approach.

I would store the likes in a second table and mabye used true / false values so used a composit key for the id. Then just determine the value in the code and output the correct answer. I think it should be something like this :

    post_id<fg> account_id<fg> | value 

This is done because only one user can like or dislike on post. Have a user that can dislike more than one post is stupid by my standard.