SQL for the Product Manager
The Feature Launch
The product team just released a new "Export to PDF" button. The PM needed to know: *"Is anyone actually using it?"* This is the essence of product analytics.
The Quest: Funnel and Feature Analysis
A funnel is a sequence of steps. We want to know how many users complete each step and where they drop off.
The Implementation: Feature Adoption Rate
-- What percentage of active users clicked the export button?
SELECT
(
COUNT(DISTINCT CASE WHEN event_name = 'export_click' THEN user_id END) * 100.0 /
COUNT(DISTINCT user_id)
) AS adoption_rate
FROM events
WHERE event_date > '2026-01-01';
Basic Funnel Query
SELECT
COUNT(DISTINCT CASE WHEN step = 'view_page' THEN user_id END) AS step_1_views,
COUNT(DISTINCT CASE WHEN step = 'add_to_cart' THEN user_id END) AS step_2_cart,
COUNT(DISTINCT CASE WHEN step = 'checkout' THEN user_id END) AS step_3_checkout,
COUNT(DISTINCT CASE WHEN step = 'purchase' THEN user_id END) AS step_4_purchase
FROM user_events;
The "Oops" Moment
I once analyzed a "New Feature" button and reported 0% adoption. It turned out the button was hidden behind a settings menu and engineers had misspelled the event name.
**Pro Tip**: Always cross-reference your event names with the engineering team before building a report. A single typo can make a feature invisible.
The Victory
The PM discovered that the "Export to PDF" button had a 12% adoption rate—well above the 5% target. They used my data to justify adding more "Export" features. SQL gave the product team confidence in their roadmap.
Your Task for Today
Calculate the adoption rate of any "Flag" or "Event" in your database using `COUNT(DISTINCT CASE WHEN ...)`.
*Day 27: Building Dashboards with SQL.*