title: mysql cannot create table - error 1005
body: <p>I'm a student and I'm just trying out some basic mysql. However I keep getting the same error when it comes to the following piece of code. </p>
  
  <blockquote>
    <p>Error Code: 1005. Can't create table 'mydatabase.orders' (errno: 150)</p>
  </blockquote>
  
  <pre><code>CREATE TABLE Customer
  (
  P_ID int(3) UNSIGNED NOT NULL,
  LastName varchar(10) NOT NULL,
  FirstName varchar(10) NOT NULL,
  Address varchar(20) NOT NULL,
  City varchar(10) NOT NULL
  );
  
  
  CREATE TABLE Orders
  (
  O_ID int(3) UNSIGNED NOT NULL,
  OrderNo int NOT NULL,
  P_ID int(3) UNSIGNED NOT NULL,
  PRIMARY KEY (O_ID),
  FOREIGN KEY(P_ID)REFERENCES Customer(P_ID)
  );
  </code></pre>