27 Business Questions Converted Into SQL Queries

27 Business Questions Converted Into SQL Queries

Knowing SQL syntax is easy.

Knowing what query to write when a business asks a question is the real skill.

Below are 27 real business questions and the SQL thinking behind answering them.
These are the kinds of questions analysts get asked in:

  • Meetings
  • Dashboards
  • Take-home tests
  • Real jobs

How to Read Business Questions Like an Analyst

Every business question hides:

  • A metric
  • A time window
  • A grouping
  • A comparison

Your job is to translate words → logic → SQL.

Revenue & Sales Questions

1. How much revenue did we make last month?

SELECT SUM(amount)
FROM orders
WHERE order_date >= '2026-01-01'
  AND order_date < '2026-02-01';

2. Which products generate the most revenue?

SELECT product_id, SUM(amount) AS revenue
FROM orders
GROUP BY product_id
ORDER BY revenue DESC;

3. What is the average order value?

SELECT AVG(amount) AS avg_order_value
FROM orders;

4. How has revenue changed month over month?

SELECT DATE_TRUNC('month', order_date) AS month,
       SUM(amount) AS revenue
FROM orders
GROUP BY month
ORDER BY month;

Customer Questions

5. How many active customers do we have?

SELECT COUNT(DISTINCT customer_id)
FROM orders
WHERE order_date >= CURRENT_DATE - INTERVAL '30 days';

6. Who are our top 10 customers by revenue?

SELECT customer_id, SUM(amount) AS revenue
FROM orders
GROUP BY customer_id
ORDER BY revenue DESC
LIMIT 10;

7. How many new customers signed up this month?

SELECT COUNT(*)
FROM customers
WHERE signup_date >= DATE_TRUNC('month', CURRENT_DATE);

8. Which customers have never placed an order?

SELECT c.customer_id
FROM customers c
LEFT JOIN orders o
ON c.customer_id = o.customer_id
WHERE o.customer_id IS NULL;

Retention & Churn Questions

9. What percentage of customers returned after their first purchase?

SELECT COUNT(DISTINCT customer_id) * 1.0
       / (SELECT COUNT(DISTINCT customer_id) FROM orders)
FROM orders
WHERE order_number > 1;

10. Which customers haven’t purchased in 90 days?

SELECT customer_id
FROM orders
GROUP BY customer_id
HAVING MAX(order_date) < CURRENT_DATE - INTERVAL '90 days';

Product & Category Questions

11. Which product categories perform best?

SELECT category, SUM(amount) AS revenue
FROM orders
GROUP BY category
ORDER BY revenue DESC;

12. Which products are declining in sales?

SELECT product_id,
       COUNT(*) AS orders
FROM orders
WHERE order_date < CURRENT_DATE - INTERVAL '30 days'
GROUP BY product_id;

Operational Questions

13. How many orders were delayed?

SELECT COUNT(*)
FROM orders
WHERE delivery_date > expected_delivery_date;

14. What is the average delivery time?

SELECT AVG(delivery_date - order_date) AS avg_delivery_time
FROM orders;

Marketing Questions

15. Which channel brings the most customers?

SELECT acquisition_channel, COUNT(*) AS customers
FROM customers
GROUP BY acquisition_channel
ORDER BY customers DESC;

16. Which campaign generated the most revenue?

SELECT campaign_id, SUM(amount) AS revenue
FROM orders
GROUP BY campaign_id
ORDER BY revenue DESC;

Funnel Questions

17. How many users viewed but didn’t purchase?

SELECT COUNT(DISTINCT user_id)
FROM events
WHERE event_type = 'view'
AND user_id NOT IN (
    SELECT user_id FROM events WHERE event_type = 'purchase'
);

18. Where do users drop off in the funnel?

SELECT step, COUNT(DISTINCT user_id)
FROM funnel_events
GROUP BY step
ORDER BY step;

Time-Based Analysis

19. What are our busiest days?

SELECT DATE(order_date) AS day, COUNT(*) AS orders
FROM orders
GROUP BY day
ORDER BY orders DESC;

20. When do customers purchase most often?

SELECT EXTRACT(HOUR FROM order_date) AS hour,
       COUNT(*) AS orders
FROM orders
GROUP BY hour
ORDER BY orders DESC;

Quality & Risk Questions

21. Are there duplicate transactions?

SELECT transaction_id, COUNT(*)
FROM orders
GROUP BY transaction_id
HAVING COUNT(*) > 1;

22. Which orders have missing values?

SELECT *
FROM orders
WHERE amount IS NULL
   OR customer_id IS NULL;

Business Insight Questions

23. Which customers are high-value?

SELECT customer_id, SUM(amount) AS lifetime_value
FROM orders
GROUP BY customer_id
HAVING SUM(amount) > 1000;

24. Which products should we promote more?

SELECT product_id, COUNT(*) AS orders
FROM orders
GROUP BY product_id
ORDER BY orders DESC;

Advanced Thinking

25. What is revenue per customer?

SELECT SUM(amount) / COUNT(DISTINCT customer_id)
FROM orders;

26. Which customers are at risk of churn?

SELECT customer_id
FROM orders
GROUP BY customer_id
HAVING MAX(order_date) < CURRENT_DATE - INTERVAL '60 days';

27. Are sales concentrated among few customers?

SELECT customer_id, SUM(amount) AS revenue
FROM orders
GROUP BY customer_id
ORDER BY revenue DESC;

What This Teaches You

Business questions rarely mention SQL.

They mention:

  • Time
  • Money
  • Customers
  • Change

Your job is to translate that into logic.

SQL isn’t about memorizing commands.

It’s about answering questions that matter to the business.

If you can convert questions into queries, you’re job-ready.

FAQs

1. Are these SQL questions used in real jobs?

Yes. These mirror real stakeholder and interview questions.

2. Do I need advanced SQL to answer business questions?

No. Strong fundamentals are enough for most cases.

3. Should analysts memorize these queries?

No. Focus on understanding the logic behind them.

4. Are these queries optimized for production?

They show logic; performance tuning depends on data size.

5. Is this useful for interviews and take-home tests?

Absolutely. This is exactly what companies test.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top