10ff
10ff

Reputation: 813

Composite Foreign Key

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

CREATE TABLE Album( 
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)
)  
ENGINE=INNODB 

I can tell you, that the columns "Name", "Gründungsjahr" and "Gründungsort" exist in the referenced Table Band as the 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.

Upvotes: 0

Views: 220

Answers (1)

Alex Monthy
Alex Monthy

Reputation: 1877

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

Upvotes: 1

Related Questions