My MYSQL + MS SQL answers
My MySQL solution: Firstly, you need exclude the products which are not in the product list. Secondly, you need to delete the duplicates, which means one custom
My MySQL solution: Firstly, you need exclude the products which are not in the product list. Secondly, you need to delete the duplicates, which means one customer buy the same product multiple times. Then you just need to make sure the number of distinct product each customer buys is equal to the number of distinct product on the list. \n\nMySQL:\n```\nSELECT customer_id\nFROM (\nSELECT DISTINCT *\nFROM Customer\nWHERE product_key IN (SELECT DISTINCT product_key FROM Product)) AS temp\nGROUP BY customer_id\nHAVING COUNT(DISTINCT product_key) = (SELECT COUNT(DISTINCT product_key) FROM Product)\n```\n\nMS SQL:\n```\n\nSELECT DISTINCT customer_id\nFROM (\n    \nSELECT *, MAX(CT) OVER(PARTITION BY customer_id) AS MX\n    \nFROM (  \nSELECT *, DENSE_RANK() OVER(PARTITION BY customer_id ORDER BY product_key) AS CT\nFROM Customer\nWHERE product_key IN (SELECT DISTINCT product_key FROM Product)) AS temp1\n    \n ) AS temp2\nWHERE MX = (SELECT COUNT(DISTINCT product_key) FROM Product)\n```
[]