Most businesses query their database for the same 3โ4 things: revenue, user count, maybe a monthly report. But your data can tell you who's about to churn, which product combinations sell best, and where you're bleeding money โ if you know what to ask.
This guide gives you 10 high-value questions you can ask in plain English, the SQL that answers them, and โ most importantly โ what to do with the answer. Each question is one that real operators have told us they wish they'd asked sooner.
Most businesses discover churn after it happens. This question catches it while you can still act โ a simple win-back email to dormant customers recovers 5โ15% on average.
FROM customers c
JOIN orders o ON c.id = o.customer_id
WHERE o.created_at > NOW() - INTERVAL '6 months'
GROUP BY c.id, c.name, c.email
HAVING MAX(o.created_at) < NOW() - INTERVAL '60 days'
ORDER BY last_order DESC;
Time saved: 2 hours of manual CRM digging โ 10 seconds with a plain-English question.
Gross revenue lies. Once you subtract refunds, chargebacks, and discounts, your "best seller" might be your worst performer. This question shows the real picture.
SUM(oi.subtotal) AS gross,
SUM(oi.discount_amount) AS discounts,
SUM(CASE WHEN o.status = 'refunded' THEN oi.subtotal ELSE 0 END) AS refunds,
SUM(oi.subtotal) - SUM(oi.discount_amount)
- SUM(CASE WHEN o.status='refunded' THEN oi.subtotal ELSE 0 END) AS net_revenue
FROM order_items oi
JOIN products p ON oi.product_id = p.id
JOIN orders o ON oi.order_id = o.id
WHERE o.created_at >= DATE_TRUNC('quarter', NOW()) - INTERVAL '3 months'
GROUP BY p.name ORDER BY net_revenue DESC;
Decision unlocked: Stop promoting the high-refund product. Double down on what actually keeps revenue.
Timing your marketing spend to match your natural conversion peaks can improve ROI by 20โ30%. Most founders guess. This question gives you data.
TO_CHAR(created_at, 'Day') AS day_of_week,
EXTRACT(HOUR FROM created_at) AS hour,
COUNT(*) AS signups
FROM users
WHERE created_at >= NOW() - INTERVAL '3 months'
GROUP BY day_of_week, hour
ORDER BY signups DESC
LIMIT 20;
Time saved: No more guessing when to send that newsletter or launch that campaign.
Unlock the remaining 7 questions
Enter your email to unlock the remaining 7 questions + get future data insights delivered to your inbox.
The Pareto principle in action โ typically 20% of customers drive 80% of revenue. Knowing who they are lets you give them VIP treatment and find more people like them.
COUNT(o.id) AS orders,
SUM(o.total) AS lifetime_value,
MIN(o.created_at) AS customer_since
FROM customers c
JOIN orders o ON c.id = o.customer_id
WHERE o.status = 'completed'
GROUP BY c.id, c.name, c.email
ORDER BY lifetime_value DESC
LIMIT 20;
Amazon makes 35% of revenue from "frequently bought together" recommendations. You have the same data โ you're just not using it yet.
COUNT(*) AS times_bought_together
FROM order_items oi1
JOIN order_items oi2 ON oi1.order_id = oi2.order_id AND oi1.product_id < oi2.product_id
JOIN products p1 ON oi1.product_id = p1.id
JOIN products p2 ON oi2.product_id = p2.id
GROUP BY p1.name, p2.name
ORDER BY times_bought_together DESC
LIMIT 10;
These queries took a data team hours to write. With SightQL, you just ask in English.
Try the interactive demo โThis is your activation window. If most buyers convert within 3 days, your onboarding emails after Day 7 are wasted. Focus your nurture sequence where it matters.
DATE_TRUNC('month', u.created_at) AS signup_month,
ROUND(AVG(EXTRACT(EPOCH FROM (MIN(o.created_at) - u.created_at)) / 86400), 1) AS avg_days_to_first_order,
COUNT(DISTINCT u.id) AS users_who_ordered
FROM users u
JOIN orders o ON u.id = o.user_id
GROUP BY signup_month
ORDER BY signup_month DESC;
A flat revenue number is meaningless without trend context. This question shows whether you're accelerating, plateauing, or declining โ and how fast.
SELECT DATE_TRUNC('month', created_at) AS month,
SUM(total) AS revenue
FROM orders WHERE status = 'completed'
AND created_at >= NOW() - INTERVAL '12 months'
GROUP BY month
)
SELECT month, revenue,
ROUND((revenue - LAG(revenue) OVER (ORDER BY month))
/ LAG(revenue) OVER (ORDER BY month) * 100, 1) AS pct_change
FROM monthly ORDER BY month;
You might get more signups from Twitter but more revenue from Google. This question tells you where to spend your next marketing dollar.
COUNT(DISTINCT u.id) AS customers,
ROUND(AVG(customer_ltv.total_spend), 2) AS avg_ltv
FROM users u
JOIN (
SELECT user_id, SUM(total) AS total_spend
FROM orders WHERE status = 'completed'
GROUP BY user_id
) customer_ltv ON u.id = customer_ltv.user_id
WHERE u.source IS NOT NULL
GROUP BY u.source
ORDER BY avg_ltv DESC;
Stuck orders = angry customers. Most teams discover these when someone complains. A daily question like this catches problems before they become 1-star reviews.
o.created_at,
NOW() - o.created_at AS stuck_duration
FROM orders o
JOIN customers c ON o.customer_id = c.id
WHERE o.status = 'processing'
AND o.created_at < NOW() - INTERVAL '48 hours'
ORDER BY o.created_at ASC;
With SightQL: Schedule this as a daily report to Slack. Never miss a stuck order again.
Acquisition is expensive. If only 8% of customers come back for a second purchase, you have a retention problem โ not a growth problem. This number changes your entire strategy.
SELECT user_id, MIN(created_at) AS first_order_date
FROM orders WHERE status = 'completed'
GROUP BY user_id
),
repeat_buyers AS (
SELECT fo.user_id
FROM first_orders fo
JOIN orders o ON fo.user_id = o.user_id
AND o.created_at > fo.first_order_date
AND o.status = 'completed'
GROUP BY fo.user_id
)
SELECT
COUNT(DISTINCT fo.user_id) AS total_buyers,
COUNT(DISTINCT rb.user_id) AS repeat_buyers,
ROUND(COUNT(DISTINCT rb.user_id)::numeric / COUNT(DISTINCT fo.user_id) * 100, 1) AS repeat_rate
FROM first_orders fo
LEFT JOIN repeat_buyers rb ON fo.user_id = rb.user_id;
Stop guessing. Start asking.
These 10 questions are just the beginning. SightQL connects to your PostgreSQL or MySQL database and lets you ask anything in plain English โ no SQL skills needed.
Try the Interactive Demo โFree tier: 50 queries/month ยท No credit card required
๐ Early Access: First 10 users get Pro features free for 3 months.
Join the waitlist โ
๐ค Share this guide
Know a founder or operator who's sitting on untapped data? Send them this guide: sightql.devhelper.my.id/guide