error code:
ALTER TABLE inventoryitems ADD CONSTRAINT fk_itempetid FOREIGN KEY (petid) REFERENCES pets (petid) ON DELETE SET NULL ; # thanks Optimist for noticing queries over petid taking too long, shavit for pointing out an improvement using foreign key
error code: ALTER TABLE
inventoryitems
ADD CONSTRAINTfk_itempetid
FOREIGN KEY (petid
) REFERENCESpets
(petid
) ON DELETE SET NULL ; # thanks Optimist for noticing queries over petid taking too long, shavit for pointing out an improvement using foreign keyforeign key not exists. : )