Do you want something like this?
select customerId
from customerproducts cp
group by customerId
having sum(case when product not in ('Database', 'DNS Record') then 1 else 0 end) = 0 and
sum(case when product in ('Database', 'DNS Record' then 1 else 0 end) > 0
This returns all customers that have only 'Database'
and 'DNS Record'
products.