废话少说,直接上代码:
create table policy
(
id int not null unique auto_increment primary key,
name varchar(40) not null,
description varchar(255)
);
create table policy_profit
(
id int not null unique auto_increment primary key,
policy_id INT not null,
time char(40) not null,
profit float not null
);
alter table policy_profit add
CONSTRAINT C1 foreign key (policy_id) references policy(id) on delete CASCADE