title: Creating a parent and child table, does child need its own primary id column?
body: <p>When we create parent-child tables, does the child table need its own primary key, or should the foreign key of the parent be used as the primary key?</p>
  
  <p>Example:</p>
  
  <p>I have a table that stores users, which is defined like:</p>
  
  <pre><code>CREATE TABLE users (
      'id' bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
      'username' varchar(32),
      PRIMARY KEY ('id'))
  </code></pre>
  
  <p>I want to make a second table that stores some more information about a user, like their favorite animals. Should that table have its own 'id' column as well as a separate foreign key for the linked user?:</p>
  
  <pre><code>CREATE TABLE users_extra_info (
      'id' bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
      'fk_user_id' bigint(20) UNSIGNED NOT NULL,
      'fav_mammal' varchar(32),
      'fav_reptile' varchar(32),
       ...
      PRIMARY KEY ('id'),
      KEY 'fk_user_id' ('fk_user_id'))
  </code></pre>
  
  <p>or do you usually just drop the 'id' column since the foreign key has to be unique?:</p>
  
  <pre><code>CREATE TABLE users_extra_info (
      'fk_user_id' bigint(20) UNSIGNED NOT NULL,
      'fav_mammal' varchar(32),
      'fav_reptile' varchar(32),
       ...
      PRIMARY KEY ('fk_user_id'))
  </code></pre>
  
  <p>Thanks</p>