title: MySQL error cannot add foreign key constraint
body: <p>what is wrong?</p>
  
  <pre><code>mysql&gt; create table price(
      -&gt; p_code char(1) not null,
      -&gt; p_description varchar(20),
      -&gt; p_rentfee decimal(2,2) not null,
      -&gt; p_dylatefee decimal(2,2));
  Query OK, 0 rows affected (0.18 sec)
  
  mysql&gt; create table movie(
      -&gt; mv_no char(4) not null,
      -&gt; mv_name varchar(50) not null,
      -&gt; mv_year char(4) not null,
      -&gt; mv_cost decimal(2,2) not null,
      -&gt; mv_genre varchar(15) not null,
      -&gt; p_code char(1) not null,
      -&gt; foreign key (p_code) references price(p_code));
  ERROR 1215 (HY000): Cannot add foreign key constraint
  
  mysql&gt;
  </code></pre>