From 322252c44d8b004ea93599d8efbcf60b3315559e Mon Sep 17 00:00:00 2001 From: Krishna Dheeraj Krovi Date: Wed, 15 Jul 2026 23:58:12 -0700 Subject: [PATCH] added mock interview problem --- problem1.sql | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 problem1.sql diff --git a/problem1.sql b/problem1.sql new file mode 100644 index 0000000..1c834f1 --- /dev/null +++ b/problem1.sql @@ -0,0 +1,13 @@ +""" +1. We need to report the customer ids from the Customer table that bought all the products in the Product table. +2. So we first check the distinct products bought by each customer +3. We filter out the customers who dont have the count same as number of unique products +""" + +with cte as +(select customer_id , count(distinct product_key) 'num' + from Customer + group by customer_id + having num = (select count(*) from Product) +) +select cte.customer_id from cte; \ No newline at end of file