sql - How would you design a table to keep track of users' likes and dislikes in mysql -


I want to get my thoughts about preparing a table to store user's likes and dislikes so that people One user can check like / dislike history Suppose I have a list of thousands of products, each of them can be liked or disliked. I have a user ID, product in every line

user_like preference and dislike

  user_id product_id Tom Toys May Toys Peter Toed Tom Toys Peter Toys  

user_dislike Table

  user_id product_id Tom ToysB Tom Toyoine May Toyov Paul Paula Paul Paula  

Is this a suitable approach? Or I should use the conset to add it to a table like user_like_dislike as a record end, for example:

user_like_dislike

  user_id Tom likes to like toy, toy toyab, toy mayy toy toynow paul toy, toy peter puppy, toy   

I have only one table, user_likes, with columns such as:

  user_likes (user_id, product_id, like_type)  

Use a primary key on user_id and product_id (a user should not be able to like and dislike the product)


Comments

Popular posts from this blog

html - Trouble with image gallery on codepen -

java - org.apache.http.ProtocolException: Target host is not specified -

How to access user directory in lazarus? -