title: Microblog table relationship with foreign key, trouble with followers?
body: <p>I'm having a small problem thinking a small microblog system i'm doing for exercise. I have three tables: </p>
  
  <pre><code>users
    id
    username
  
  tweets
    id
    tweet
  
  followers
    id_user
    id_following
  </code></pre>
  
  <p>How do i make the relationship for followers? id_user and id_following are both PKs that relate to the same table?</p>
  
  <p>Here's my query:</p>
  
  <pre><code>CREATE TABLE tweets (
    tweet_id INT NOT NULL AUTO_INCREMENT,
    tweet VARCHAR(140) NOT NULL,
    PRIMARY KEY (tweet_id)
  ) ENGINE=INNODB;
  
  
  CREATE TABLE users (
    user_id INT NOT NULL AUTO_INCREMENT,
    user VARCHAR(255) NOT NULL,
    password VARCHAR(40) NOT NULL,
    email VARCHAR(255) NOT NULL,
    PRIMARY KEY (user_id)
  ) ENGINE=INNODB;
  
  CREATE TABLE user_tweets (
    id INT NOT NULL AUTO_INCREMENT,
    id_user INT NOT NULL,
    id_tweet INT NOT NULL,
    PRIMARY KEY(id),
    FOREIGN KEY (id_tweet)
      REFERENCES tweets(tweeth_id)
        ON UPDATE NO ACTION ON DELETE NO ACTION,
    FOREIGN KEY (id_user)
      REFERENCES users(user_id)) ENGINE=INNODB;
  
  CREATE TABLE followers (
    id_user INT NOT NULL REFERENCES users (user_id),
    id_following INT NOT NULL REFERENCES users (user_id),
    PRIMARY KEY (id_user, id_following)
  ) ENGINE=INNODB;
  </code></pre>