products lists every product in the Azure catalog (product_id) and customer_contracts has one row per subscription (customer_id, product_id); a customer can hold the same product twice and some contracts may reference retired products that are no longer in products. Return customers who subscribe to every product currently in products. Output column: customer_id. Order by customer_id ascending.
| Column | Type |
|---|---|
| customer_id | INTEGER |
| product_id | INTEGER |
| customer_id | product_id |
|---|---|
| 1 | 10 |
| 1 | 20 |
| 1 | 30 |
| 2 | 10 |
| 2 | 20 |
| 3 | 10 |
| 3 | 20 |
| 3 | 30 |
| Column | Type |
|---|---|
| product_id | INTEGER |
| product_id |
|---|
| 10 |
| 20 |
| 30 |
| customer_id |
|---|
| 1 |
| 3 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
‹ Listening Duration by Track · Daily Sensor Position Averages ›
{{ totalCount }} questions in the style asked at Amazon, Microsoft, Google, Meta, Flipkart and more — {{ hardPct }}% Hard. Write SQL in a real database engine in your browser, run it on sample data, then evaluate against hidden tests.
Company tags show where this type of question is commonly reported in interviews. Questions, data and solutions are written by TechTown.
{{ cur.statement }}
No submissions yet. Press Evaluate to submit your query.
{{ solutionSql }}
{{ out.error }}
You have solved your 3 free questions — nice work! Log in (free) to unlock all 150 questions, keep your streak and appear on the leaderboard.