customer_id
from the Customer
table.customer_id
to prepare for counting the distinct products each customer bought.product_key
for each grouped customer_id
.HAVING
clause to filter only those customers whose count of distinct product_key
is equal to the total number of products in the Product
table. This total is obtained by a subquery that counts all entries in the Product
table.customer_id
of customers who meet the criteria.erDiagram Customer { int customer_id int product_key } Product { int product_key } Customer }|--|| Product : has