SQL Funnel Analysis Interview Questions
Practice distinct counts, stage reach, conversion rates, and drop-off checks.
Funnel questions test whether you can count users or sessions through a sequence without double-counting event rows. The key move is usuallycount(distinct ...), because one session can produce many event records.
Before writing SQL, clarify the entity being measured: sessions, users, accounts, orders, or visitors. The same event table can answer different business questions depending on that grain.
Common funnel interview prompts
- Count how many sessions reached each funnel stage.
- Calculate purchase rate by marketing channel.
- Find the largest drop-off between signup, checkout, and purchase.
- Compare conversion for logged-in versus anonymous sessions.
- Explain why counting event rows can overstate conversion.
select event_name,
count(distinct session_id) as sessions,
round(
100.0 * count(distinct session_id) /
(select count(*) from sessions),
1
) as pct_of_sessions
from events
group by event_name
order by sessions desc, event_nameWhat matters
A funnel stage is usually "did the entity reach this event at least once?" That means count(distinct session_id), notcount(*). Counting rows answers "how many event records exist", which can inflate stage reach when sessions repeat actions.
For segmented conversion, keep the base table on the left side of the join. Starting from sessions preserves channels with no purchases, while starting from purchase events drops those zero-conversion groups.
select s.channel,
count(distinct s.session_id) as sessions,
count(distinct e.session_id) filter (
where e.event_name = 'purchase'
) as purchasing_sessions
from sessions as s
left join events as e on e.session_id = s.session_id
group by s.channel
order by purchasing_sessions desc, s.channelHow to talk it through
Say: "The result is one row per channel. Sessions are the base population, so I will start from the sessions table, left join events, count distinct sessions overall, and count distinct sessions that reached purchase."
Call out the denominator. A percentage can use all sessions, sessions within a channel, or sessions that reached the previous funnel step. Those are different metrics.
Practice next
Work through theweb conversion funnel,channel conversion mission, andretention cohort mission. Review integer division before writing conversion rates.
Quick answers
What should I clarify first in a SQL funnel interview question?
Clarify the entity being measured, such as sessions, users, accounts, or orders, because that choice controls the denominator.
Why do funnel queries often use COUNT DISTINCT?
A single session or user can create many event rows, so COUNT DISTINCT measures whether the entity reached a stage instead of counting every event.
How should I choose the denominator for conversion rate?
State whether the denominator is all starting sessions, sessions in the same segment, or sessions that reached the previous step.