आप ON DELETE CASCADE . के साथ कर सकते हैं ।
ALTER TABLE childTable
ADD CONSTRAINT `FK_key` FOREIGN KEY (`childColumnName`)
REFERENCES parentTable(`parentColumnName`) ON UPDATE CASCADE ON DELETE CASCADE
या
बनाएं AFTER DELETE TRIGGER
पैरेंट टेबल . पर . चाइल्ड टेबल की DELETE क्वेरी जोड़ें।
DELIMITER $$
CREATE
TRIGGER `tn_aur_department_master` AFTER DELETE ON `tn_parentTable`
FOR EACH ROW BEGIN
DELETE FROM childTable WHERE parentId = old.parentId;
END;
$$
DELIMITER ;