Group BY ||
Intuition\n Describe your first thoughts on how to solve this problem. \nGroup by\n# Approach\n Describe your approach to solving the problem. \n1. GROUP BY cus
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nGroup by\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. GROUP BY customer_id\n2. Set the condition in HAVING clause. If count of distinct product key in Customer table grouped with customer_id is equal to Count of product key in Product table then it will determine that if customer has all the distinct product id with it.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n# Write your MySQL query statement below\\\nSELECT customer_id\nFROM Customer \nGROUP BY customer_id\nHAVING COUNT(DISTINCT product_key) = (SELECT COUNT(*) FROM Product)\n```
['MySQL']