YM0731
5/28/2019 - 12:22 PM

マスタと明細データを同時に消す

--商品テーブルを削除したときに売り上げテーブルも同時に削除する

create table sales5(
id int(11) not null auto_increment,
product int(11) not null,
amount int(11) not null,
primary key (id),
foreign key(product)
references products(id) on delete cascade)