if you have parent table
create table parent (
pid int not null,
name varchar(255)
)
and a parent-child join table
create table parent_child (
pid int not null,
cid int not null,
foreign key (pid) references parent(pid),
foreign key (cid) references child(cid)
)
create table child(
cid int not null,
name varchar(255)
)
How can I find all parent's names where all their children have names in the following list ('dave','henry','myriam','jill').
I don't want to see a parent if they have a child with a different name, but if they have 1 or more children and all their children have names in the list I want to see the parent's name.
I did find this https://stackoverflow.com/a/304314/1916621 that will help me find a parent with children of the exactly those names, but I can't figure out how to the parents who only have children with names in a subset of that list.
Extra points if someone knows performance tradeoff for different approaches.