title: Error Code: 1822. Failed to add the foreign key constraint. Missing index for constraint 'employee_ibfk_1' in the referenced table 'Address'
body: <p>Created two tables namely Address and Employee.With relationship employee has a n address. The DB script as below. </p>
  
  <pre><code>create table address(addressid int,city varchar(10),pincode varchar(10));
  
  insert into address(addressid,city,pincode) values(201,'Hosur',635109);
  
  create table employee(empid int , firstname varchar(20),lastname varchar(20),department varchar(10),emailAddress varchar(50),baseLocation varchar(20),address int,FOREIGN KEY (Address) REFERENCES Address(addressId));
  </code></pre>
  
  <p>But I get the following error while trying to create the employee table:</p>
  
  <blockquote>
    <p>Error Code: 1822. Failed to add the foreign key constraint. Missing
    index for constraint 'employee_ibfk_1' in the referenced table
    'Address' 0.117 sec</p>
  </blockquote>