You can use group by
and having
:
select name
from t
group by name
having count(*) = (select count(distinct type) from t);
This assumes that the name
/type
rows are not repeated in the table.
Edit:
If you just want to check for A/B/C, then:
select name
from t
where type in ('A', 'B', 'C')
group by name
having count(*) = 3;
Or:
having count(distinct type) = 3
if the table has duplicates.
4
solved Select every rows that contains all elements of group