create table `oberflaeche` ( `oName` varchar(50) not null, primary key(oName) ) type=InnoDB; create table `unterkonstruktion` ( `ukName` varchar(50) not null, primary key(ukName) ) type=InnoDB; create table `format` ( `typ` varchar(20) not null, primary key(typ) ) type=InnoDB; create table `produkt` ( `id` int unsigned not null auto_increment, `oName` varchar(50) not null, `ukName` varchar(50) not null, `format` varchar(20) not null, primary key(id), foreign key (format) REFERENCES format(typ) on delete cascade, foreign key (oName) REFERENCES oberflaeche(oName) on delete cascade, foreign key (ukName) REFERENCES unterkonstruktion(ukName) on delete cascade ) type=InnoDB; create table `rohstoff` ( `id` int unsigned not null auto_increment, `name` varchar(50) not null, `einheit` varchar(3) not null comment 'stk, kg oder m2', `format` varchar(20) default null, `preis` float not null, primary key (id), foreign key (format) REFERENCES format(typ) on delete cascade, ) type=InnoDB; create table `r_to_o` ( `rName` varchar(50) not null, `oName` varchar(50) not null, primary key(rName, oName), foreign key (rName) REFERENCES rohstoff(name) on delete cascade, foreign key (oName) REFERENCES oberflaeche(oName) on delete cascade ) type=InnoDB; create table `r_to_uk` ( `rName` varchar(50) not null, `ukName` varchar(50) not null, primary key (rName, ukName), foreign key (rName) REFERENCES rohstoff(name) on delete cascade, foreign key (ukName) REFERENCES unterkonstruktion(ukName) on delete cascade ) type=InnoDB; Fehler : ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'forma t(typ) on delete cascade, foreign key (oName) REFERENCES oberflaeche(' at line 8 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'forma t(typ) on delete cascade, ) type=InnoDB' at line 9 ERROR 1005 (HY000): Can't create table '.\modulea\r_to_o.frm' (errno: 150) ERROR 1005 (HY000): Can't create table '.\modulea\r_to_uk.frm' (errno: 150)