You need to add a foreign key in student and parent that maps back to family_id, Remove parent_id and student_id in the Family table. If you need to find all member of family 22
select * from family f
join parent p on f.family_id=p.family_id
join student s on s.family_id=f.family_id
where f.family_id=22
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.