Let’s suppose that I have a foreign key whose actions are:
on delete set default, on update cascade
If I want to change the action, how do I specify this in the alter table options?
I have tried this:
change my_table add on delete cascade my_key;
But it gives a syntax error:
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 'on delete cascade matricola' at line 1
I want to change the default action triggered when the primary key referenced is deleted.
As far as i know you have to drop your key and create new one with new rules.