How to structure a database for a subscription system / subscribers? Ie there is a user who subscribes to another, and the user that has subscribed, are displayed on the main news of the one to whom he subscribed. and another user in turn simply sees his subscribers. without any requests for friends

Closed due to the fact that it is necessary to reformulate the question so that it was possible to give an objectively correct answer by the participants of Streletz , aleksandr barakin , user194374, Denis , Dmitriy Simushev 25 Aug '16 at 20:55 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • one
    Many to many, not? - Vladimir Martyanov
  • one
    A table with two fields: ID-one-someone-subscribed, ID-by-someone-signed. Primary key - both fields together. - Mike

1 answer 1

I will cite the first that occurred at least.

Table Users :

 id INT AUTO_INCREMENT NOT NULL PRIMARY KEY name varchar(255) NOT NULL email varchar(255) NOT NULL .... 

Table News :

 id INT AUTO_INCREMENT NOT NULL PRIMARY KEY title varchar(255) NOT NULL user_id int(11) NOT NULL [INDEX] content text .... 

Table Subscribe

 id INT AUTO_INCREMENT NOT NULL PRIMARY KEY user_id int(11) NOT NULL [INDEX] subscribe_id int(11) NOT NULL [INDEX]