title: Understanding MySQL CREATE TABLE syntax
body: <p>I have the the following Django model:</p>
  
  <pre><code>class UserProfile(models.Model):
      user = models.ForeignKey(User, unique=True)
      full_name = models.CharField(max_length=100)
      network = models.ForeignKey(Network)
      positions = models.ManyToManyField(Position, through ='Timestamp', blank=True)
      featured_video = models.ForeignKey(VideoInfo, blank=True, null=True)
  </code></pre>
  
  <p>From <code>SHOW CREATE TABLE userprofile_userprofile</code>, I get the following MySQL output: </p>
  
  <pre><code>| userprofile_userprofile | CREATE TABLE `userprofile_userprofile` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `user_id` int(11) NOT NULL,
    `full_name` varchar(100) NOT NULL,
    `network_id` int(11) NOT NULL,
    `featured_video_id` int(11) DEFAULT NULL,
    `bio` longtext NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `user_id` (`user_id`),
    KEY `userprofile_userprofile_fb2a452b` (`network_id`),
    KEY `userprofile_userprofile_58bbe944` (`featured_video_id`),
    CONSTRAINT `featured_video_id_refs_id_b7c2ab56` FOREIGN KEY (`featured_video_id`) REFERENCES `userprofile_videoinfo` (`id`),
    CONSTRAINT `network_id_refs_id_f5c27879` FOREIGN KEY (`network_id`) REFERENCES `network_network` (`id`),
    CONSTRAINT `user_id_refs_id_da7416c6` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=31034 DEFAULT CHARSET=latin1 |
  </code></pre>
  
  <p>What do the last seven lines doing here?  What significance do they have?</p>
  
  <ul>
  <li><code>unique key</code></li>
  <li><code>key</code></li>
  <li><code>constraint</code></li>
  <li><code>engine=InnoDB</code></li>
  <li><code>auto-increment=31034</code></li>
  </ul>