drop table if exists family; /*==============================================================*/ /* Table: family */ /*==============================================================*/ create table family ( serial_fml int not null auto_increment, first_surname_fml varchar(255) not null, last_surname_fml varchar(255), address_fml text, phone_fml varchar(255), status_fml enum('ACTIVE','INACTIVE') not null default 'ACTIVE', primary key (serial_fml) ) ENGINE=InnoDB; /*==============================================================*/ /* Table: family_guardian */ /*==============================================================*/ create table family_guardian ( serial_grd int not null, serial_fml int not null, status_fmg enum('ACTIVE','INACTIVE') not null default 'ACTIVE', primary key (serial_grd, serial_fml) ) ENGINE=InnoDB; alter table family_guardian add constraint fk_relationship_343 foreign key (serial_grd) references guardian (serial_grd) on delete restrict on update restrict; alter table family_guardian add constraint fk_relationship_345 foreign key (serial_fml) references family (serial_fml) on delete restrict on update restrict; alter table student add constraint fk_relationship_344 foreign key (serial_fml) references family (serial_fml) on delete restrict on update restrict;