Mysql constraint cannot add -


i have problem in mysql code. not allow me import sql file , give me error " #1215 - cannot add foreign key constraint "

i have no ideea do. searched here, tried examples this: mysql error: cannot add foreign key constraint? no succes.

you need use of primary key columns on fk references.

foreign key (`an`) references `studenti` (`an`)  

should be

foreign key (`idstud`, `an`) references `studenti` (`idstud`,`an`)  

of course, need add idstud teste table.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -