title: Foreign keys in MySQL?
body: <p>I have been slowly learning SQL the last few weeks. I've picked up all of the relational algebra and the basics of how relational databases work. What I'm trying to do now is learn how it's implemented.</p>
  
  <p>A stumbling block I've come across in this, is foreign keys in MySQL. I can't seem to find much about the other than that they exist in the <a href="http://en.wikipedia.org/wiki/InnoDB" rel="noreferrer">InnoDB</a> storage schema that MySQL has.</p>
  
  <p>What is a simple example of foreign keys implemented in MySQL?</p>
  
  <p>Here's part of a schema I wrote that doesn't seem to be working if you would rather point out my flaw than show me a working example.</p>
  
  <pre><code>CREATE TABLE `posts` (
  `pID` bigint(20) NOT NULL auto_increment,
  `content` text NOT NULL,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `uID` bigint(20) NOT NULL,
  `wikiptr` bigint(20) default NULL,
  `cID` bigint(20) NOT NULL,
  PRIMARY KEY  (`pID`),
  Foreign Key(`cID`) references categories,
  Foreign Key(`uID`) references users
  ) ENGINE=InnoDB;
  </code></pre>