title: MySQL error 1215 Cannot add Foreign key constraint - FK in different tables
body: <p>im new on mysql workbench, and i tried so many things to put my script working but i simply cant... Ive got these tables:</p>
  
  <pre><code>CREATE TABLE Utilizador (email varchar(40) not null, nome varchar(50) 
  not null,  dataNascimento date,  profissao varchar(50) not null,      
  reputacao double(3,2) unsigned not null, constraint pk_Utilizador     
  primary key(email))
  </code></pre>
  
  <p>This is the first table created!</p>
  
  <pre><code>CREATE TABLE POI (email varchar(40) not null,  designacaoPOI
  varchar(10) not null,  coordenadaX int,  coordenadaY int, 
  descricaoPOI varchar(200), constraint pk_POI primary key(email,
  designacaoPOI), constraint fk_POI foreign key(email) references
  Utilizador(email) on delete cascade)
  </code></pre>
  
  <p>This is the second table created!</p>
  
  <pre><code>CREATE TABLE Utilizador_POI (email varchar(40) not null, designacaoPOI
  varchar(10) not null, constraint pk_Utilizador_POI primary key(email,
  designacaoPOI), constraint fk1_Utilizador_POI foreign key(email)
  references Utilizador(email) on delete cascade,  constraint
  fk2_Utilizador_POI foreign key(designacaoPOI) references
  POI(designacaoPOI) on delete cascade)
  </code></pre>
  
  <p>This table gives me the error: Error Code: 1215. Cannot add foreign key constraint</p>
  
  <p>I did some tests and im almost sure that the problem is in the foreign key "designacaoPOI". The other FK ("email") dont give me any error, so maybe the problem is in the Table POI?</p>
  
  <p>Thanks in advanced!</p>