Link to home
Start Free TrialLog in
Avatar of BaderEX
BaderEX

asked on

mysql on delete cascade

I been trying to run this example but the constrains are not holding

CREATE TABLE parent (
  id INT NOT NULL,
  PRIMARY KEY (id)
);

CREATE TABLE child
(
 id INT,
 parent_id INT,
 FOREIGN KEY (parent_id) REFERENCES parent(id)
 ON DELETE CASCADE
);


If I delete the parent_id from parent then any id match the deleted id should be deleted from the child table but it is not  Please advice!

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Hugo88
Hugo88

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial