Premium problem34. Customers Using Every Product Family

Medium Locked

usage_events(customer_id, product_family, event_at) and product_families(product_family)

Return the customer_id of everyone who used every product family at least once during 2026, ordered by customer_id.

usage_events contains a family that is not in product_families, and it must not count toward the total. Repeat use of the same family counts once.

Tables

product_families

product_family
--------------
analytics
billing
crm

usage_events

customer_id  product_family  event_at
-----------  --------------  ----------
1            analytics       2026-01-01
1            billing         2026-02-01
1            crm             2026-03-01
1            crm             2026-04-01
2            analytics       2026-01-01
2            billing         2026-02-01
2            legacy          2026-03-01
3            analytics       2026-01-01
... 3 more row(s)

Expected result

customer_id
-----------
1

Premium problem

This one's part of Premium. Unlock the full MySQL track plus every other premium problem on the site.

Write one SELECT query