title: Help with a microblog (twitter clone) database structure?
body: <p>I'm working on an exercise that wants me to create a small twitter clone, with users, tweets and following system. Well, i came up with the following database structure: </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>
  
  <p>Is it valid? Am i missing something? Also:</p>
  
  <ul>
  <li>How do i select the tweets from a user?</li>
  <li>How do i select the followers from a user? </li>
  <li>How do i select the people a user is following?</li>
  </ul>
  
  <p>I'm getting a little lost with the foreign key concept. :(</p>