when i want to change constraint of "matkul_prasyarat" table suddenly i got error and mysql delete "matkul_prasyarat" table and then when i trying to create it again it got error no 150 this is the error
there is no index in the table which would contain
the columns as the first columns, or the data types in the
table do not match the ones in the referenced table
or one of the ON ... SET NULL columns is declared NOT NULL. Constraint:
,
CONSTRAINT `matkul_prasyarat_ibfk_2` FOREIGN KEY (`nama_matkul`) REFERENCES `matkul_list` (`nama_matkul`) ON DELETE CASCADE ON UPDATE CASCADE
how to solve this problem ?
i want to make table "matkul_prasyarat"
PK no tinyint 20 AI
no_id_matkul int 20
nama_matkul VARCHAR 50
this is the syntax that i can think of from MySQL: Can't create table (errno: 150) but it's error
CREATE TABLE matkul_prasyarat (
no INT,
nama_matkul VARCHAR,
INDEX matkul_prasyarat_ibfk_2 (nama_matkul),
FOREIGN KEY (nama_matkul)
REFERENCES matkul_list(nama_matkul)
ON DELETE CASCADE
) ENGINE=INNODB;
EDIT : syntax above alrd works i forgot to input size , thanks for ur help