Postingan lainnya
cara menambah foreign key
cara menambah foreign key di mysql pada cmd
0
2 Jawaban:
Caranya panjang gan, coba lihat link ini, semoga bisa membantu https://fanihard.blogspot.co.id/2016/08/cara-membuat-foreign-key-dari-cmd.html
0
Sumber https://dev.mysql.com/doc/refman/5.5/en/create-table-foreign-keys.html
CREATE TABLE parent (
id INT NOT NULL,
PRIMARY KEY (id)
) ENGINE=INNODB;
CREATE TABLE child (
id INT,
parent_id INT,
INDEX par_ind (parent_id),
FOREIGN KEY (parent_id)
REFERENCES parent(id)
ON DELETE CASCADE
) ENGINE=INNODB;
0