mysql menghapus dari tabel anak saat kita menghapus baris dari induk
MySQL ON DELETE CASCADE
syntax:
CREATE TABLE Employee (
emp_id int(10) NOT NULL,
...
...
PRIMARY KEY (emp_id)
);
CREATE TABLE Payment (
payment_id int(10) PRIMARY KEY NOT NULL,
emp_id int(10) NOT NULL,
...
...
FOREIGN KEY (emp_id) REFERENCES Employee (emp_id) ON DELETE CASCADE
);
Exuberant Elk