Possible Duplicate:
Setting up foreign keys in phpMyAdmin?
ALTER table podcategory add FOREIGN KEY (category_id)
REFERENCES category(category_id)
ON UPDATE RESTRICT
ON DELETE CASCADE
When i send script in phpmyadmin i get error
Can't create table './C292729_T25027/#sql-be0_30ed238.frm' (errno: 150)
How to add this FOREIGN KEY?
try this type:
ALTER TABLE `aaaa` ADD CONSTRAINT fk_comp_id FOREIGN KEY ( `comp_id` ) REFERENCES `comps` ( `id` );
Or this SO answer/question might be able to help you out for sure: Setting up foreign keys in phpMyAdmin?
fk_comp_id
is the name of the index
, - Nikson Kanti Paul
InnoDB
and reference column isindexed
column. check this answer setup foreign key - Nikson Kanti Paul