Here is an example of how it works. There is no easy command to quickly identify the constraints on a table. However, using the SHOW CREATE TABLE command we get the CREATE TABLE statement to recreate the table. This includes the names of the foreign key constraints. Using this information you can then drop the necessary constraints:
Thanks for this Ronan. I understand it but I have an error in my create table coding.
This is what successfully creates my table; it does not, obviously, designate the foreign key, although it's obviously there: create table horse
horse_id int not null auto_increment primary key,
horse_name varchar(20) not null,
horse_sire int not null,
horse_dam int not null,
horse_born year(4) not null,
trainer_id int references trainer(trainer_id)
If I prepend FOREIGN KEY to my trainer_id, which would then be FOREIGN KEY (trainer_id) int references trainer(trainer_id)
I get an error. What am I doing wrong?