logo

Back to questions

Supercloud Customer [Microsoft SQL Interview Question]

Medium

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.

As of 5 Dec 2022, data in the and tables were updated.

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!

PostgreSQL 14