Clave foránea compuesta

I'm trying to create a table with a composite foreign key. I don't know what's the problem with this creation:

Name VARCHAR(30),  
Bandname VARCHAR(30), 
PRIMARY KEY(Name, Bandname),  
Erscheinungsjahr VARCHAR(30),
MusiklabelName VARCHAR(30),
BName VARCHAR(30),
BGründungsjahr INT(11),
BGründungsort VARCHAR(30),
FOREIGN KEY (BaName, BaGründungsjahr, BaGründungsort) REFERENCES Band
(Name, Gründungsjahr, Gründungsort)

I can tell you, that the columns "Name", "Gründungsjahr" and "Gründungsort" exist in the referenced Table Band como el composited primary key:

Table Band

The displayed unspecific error is:

1005 - Can't create table 'band.album' (errno: 150)

I hope that someone of you will have an idea.

preguntado el 26 de agosto de 12 a las 20:08

This might not answer your question, but you might find this useful. aquí -

Good link, thanks. But other users should know: that couldn't solve my problem. -

1 Respuestas

I assume this is a character conversion issue. Try changing the umlauts in the field names to vowels.

Respondido 26 ago 12, 21:08

Nice idea, thanks, but that didn't help, too. My solution was to replace the composite keys with single primary keys, so the whole thing got less complex. - 10ff

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.