title: MySQL Error Code 1452 Foreign Key Constraint
body: <p>I'm receiving an error when I attempt to create two tables.  There was a multivalued dependency, so I separated the tables and came up with this:</p>
  
  <pre><code>CREATE TABLE NAME (
  NameID      Integer             NOT NULL AUTO_INCREMENT,
  Name        varChar(255)        NOT NULL,
  CONSTRAINT  NAME_PK             PRIMARY KEY(NameID)
  );
  
  CREATE TABLE PHONE (
  NameID      Integer             NOT NULL,
  PhoneNumber varChar(15)         NOT NULL,
  NumType     varChar(5)          NOT NULL,
  CONSTRAINT  PHONE_FK            FOREIGN KEY(NameID)
      REFERENCES NAME(NameID),
  CONSTRAINT  PHONE_PK            PRIMARY KEY(NameID)
  );
  </code></pre>
  
  <p>But when attempting to add values with this code:</p>
  
  <pre><code>INSERT INTO NAME (NameID, Name) VALUES (default, 'John Doe');
  INSERT INTO PHONE (NameID, PhoneNumber, NumType) VALUES (default, '706-782-4719', 'Home');
  </code></pre>
  
  <p>I receive the infamous 1452 error:</p>
  
  <pre><code>Error Code: 1452. Cannot add or update a child row: a foreign key constraint fails (`phone_mcneill`.`PHONE`, CONSTRAINT `PHONE_FK` FOREIGN KEY (`NameID`) REFERENCES `NAME` (`NameID`))
  </code></pre>
  
  <p>I am not entirely sure what this means as I have NameID autoincrementing in the first table.  I can't have it auto_increment in the second one as well as it's a foreign key, correct?  Thanks in advance for the help.</p>