Back to questions

Supercloud Customer Microsoft SQL Interview Question

Supercloud Customer

Microsoft SQL Interview Question

A Microsoft Azure Supercloud customer is defined as a customer who has purchased at least one product from every product category listed in the table.

Write a query that identifies the customer IDs of these Supercloud customers.

Table:

Column NameType
customer_idinteger
product_idinteger
amountinteger

Example Input:

customer_idproduct_idamount
111000
132000
151500
223000
262000

Table:

Column NameType
product_idinteger
product_categorystring
product_namestring

Example Input:

product_idproduct_categoryproduct_name
1AnalyticsAzure Databricks
2AnalyticsAzure Stream Analytics
4ContainersAzure Kubernetes Service
5ContainersAzure Service Fabric
6ComputeVirtual Machines
7ComputeAzure Functions

Example Output:

customer_id
1

Explanation:

Customer 1 bought from Analytics, Containers, and Compute categories of Azure, and thus is a Supercloud customer. Customer 2 isn't a Supercloud customer, since they don't buy any container services from Azure.

The dataset you are querying against may have different input & output - this is just an example!

Input

Output