User Behavior Funnel Analysis with SQL: From Acquisition to Conversion,\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n
SQL queries to build conversion funnels from raw event data, identifying drop-off points and calculating conversion rates between each step.
Write SQL queries that reconstruct user journey funnels from event-level data, calculate step-by-step conversion rates, and identify the highest-impact drop-off points for optimization.
At a glance
Access
Free prompt
Open to copy without upgrading.
Prompt objective
Write SQL queries that reconstruct user journey funnels from event-level data, calculate step-by-step conversion rates, and identify the highest-impact drop-off points for optimization.
Real use case
A SaaS product has 50,000 sign-ups per month but only 8,000 reach the 'activated' state. The product team needs funnel analysis to understand exactly where users drop off between landing page visit and activation.
Customize these fields first
Replace the placeholders with your own context before you run the prompt. That usually improves the first output more than adding more instructions later.
Prompt
Write SQL queries to analyze the user conversion funnel for [PRODUCT NAME], given the following event table:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nTable: \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`user_events\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\`\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- event_id, user_id, event_type, event_timestamp, page_url, session_id, device_type, country\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nEvent types: page_view, signup_started, signup_completed, onboarding_started, onboarding_completed, first_action, activated, subscribed\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n**Query 1 — Funnel Step Volumes:**\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Count of unique users at each funnel step\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Conversion rate from previous step\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Overall conversion rate (first step to last step)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Segmented by: device_type, country, acquisition channel (derived from page_url)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n**Query 2 — Drop-off Analysis:**\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- For each step, identify the most common last action before dropping off\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Average time spent at each step before dropping off\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Users who dropped off but returned later (session gap analysis)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n**Query 3 — Time-to-Convert:**\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Median and average time between each funnel step\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Users who convert within 24h vs. 1 week vs. 1 month\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Time-to-convert by acquisition channel\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n**Query 4 — Cohort Funnel Comparison:**\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Funnel conversion rates by signup month cohort\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Is the funnel improving or degrading over time?\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Statistical significance of changes between cohorts\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n**Query 5 — Predictive Signals:**\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- What behaviors in the first session predict eventual activation?\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Correlation between number of events in first session and conversion\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n- Users who complete [SPECIFIC ACTION] within first hour are [X]x more likely to convert\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\nSQL dialect: [PostgreSQL/MySQL/BigQuery]. Use CTEs for readability.
Open directly in an AI — the text is pre-filled:
How to use this prompt
- 1Replace the key placeholders first: PRODUCT NAME, SPECIFIC ACTION, PostgreSQL/MySQL/BigQuery.
- 2Replace any bracketed placeholders like [this] with your own context.
- 3Add extra background information when you want more tailored results.
- 4Combine multiple prompts in one conversation when you need a richer output.
- 5Save your best-performing prompts so they are easy to reuse later.
Next best step
Open the guide first, then branch only if you still need more.
A guide for technical builders choosing between prompts, coding workflows, and agent-based implementation.
If this prompt is close but not quite right, generate variants next. If the job is recurring, move into the course library after the guide.
Related prompts
View allSales analysis queries with CTEs and window functions
Writes advanced SQL queries using CTEs and window functions for sales performance analysis.
Best for
Create a set of reusable SQL queries that analyze sales by period, product, seller, and region using CTEs (Common Table Expressions) and window functions for rankings and comparisons.
Database Schema Design for Recurring Subscription Systems
Designs an optimized database schema for a subscription business with SaaS metrics.
Best for
Create a complete relational model for a recurring subscription system, including tables, indexes, constraints, and ready-to-use queries for calculating MRR, churn, and LTV.
Slow Query Optimization with EXPLAIN ANALYZE and Indexes
Diagnoses and optimizes slow SQL queries using execution plans, strategic indexes, and query rewriting.
Best for
Learn to identify SQL query performance bottlenecks using EXPLAIN ANALYZE, create efficient indexes, and rewrite queries to reduce response time.
Stored Procedures for Automatic Sales Commission Calculation
Creates stored procedures that automate commission calculations with complex tiered rules and bonuses.
Best for
Develop SQL stored procedures that calculate sales commissions considering tiered quotas, product mix bonuses, cancellation clawbacks, and team splits.
Explore other prompt categories
Move sideways into adjacent libraries when the current category is not the full answer.
Free browsing stays open. Premium prompts unlock the reusable workflow layer.
Use the guides and role paths to validate the job first. Upgrade when you want the full prompt text, editable premium prompts, and the surrounding course paths in one place.
Free access
- Browse guides, role paths, and category pages.
- Preview prompts before you decide to upgrade.
- Find the right starting point without friction.
Membership access
- Unlock premium prompts and the full copy text.
- See more workflow paths and course connections.
- Keep the reusable templates in one place.