Search ⌘K
Microsoft
Microsoft

Interview Core Track · Medium · 25 min

10 Supercloud Customer

-- A Microsoft Azure Supercloud customer is defined as a company that purchases at least one product from each product category. -- Write a query that effect...

Interview Core Track
Medium
25 min
aggregation
joins
filtering

Company labels are directional practice context, not official interview guidance.

Timer 00:00
Back to practice

Objective

Practice aggregation through a Microsoft-tagged business scenario.

Approach

Use this track to improve speed, edge-case handling, and accuracy under timed conditions.

Company context

Company labels are directional practice context, not official interview guidance.

Prereq: query basics
Prereq: filtering

-- A Microsoft Azure Supercloud customer is defined as a company that purchases at least one product from each product category. -- Write a query that effectively identifies the company ID of such Supercloud customers. -- Solution : WITH supercloud_customers AS ( SELECT customer_id FROM ( SELECT customer_id, COUNT(DISTINCT product_category) AS category_count FROM customer_contracts cc JOIN products p USING (product_id) GROUP BY 1 ) x WHERE category_count = (SELECT COUNT(DISTINCT product_category) FROM products) ) SELECT customer_id FROM supercloud_customers -- my approach: wasn't sure on how to add "category_count". WITH supercloud_customers as ( SELECT customer_id, product_category, count(product_id) FROM customer_contracts cc JOIN products p USING(product_id) GROUP BY 1, 2 ORDER BY 1, 2 ) SELECT customer_id FROM supercloud_customers -- remarks:

Pro question
This is a Pro question

Upgrade to Pro to unlock this prompt, the SQL workspace, and all 254 problems.

Upgrade to Pro — unlock all 254 problems
Editor
SQL workspace

Run queries against the protected question data, then submit once the result shape looks right.

Sign in to run SQL

Create a free account or sign in before running queries against protected question data.