Use Case Guides

Data Analysis

Data Analysis

WhoDB is a powerful tool for data analysts, business intelligence professionals, and anyone who needs to extract insights from databases. Whether you're answering business questions, preparing data for reports, or investigating anomalies, WhoDB provides the tools to analyze data efficiently.

Data Analysis Workflow

Phase 1: Explore and Filter

Start by understanding what data you're working with:

Phase 2: Sort and Organize

Once you have the right subset, organize it for analysis:

Phase 3: Run Analysis Queries

For sophisticated analysis, switch to the Scratchpad to write custom SQL:

Common Analysis Query Patterns

Aggregations & Summaries

Use GROUP BY to summarize data by category:

sql

-- Revenue by customer tier
SELECT
  customer_tier,
  COUNT(*) as customer_count,
  SUM(lifetime_value) as total_value,
  AVG(lifetime_value) as avg_customer_value
FROM customers
GROUP BY customer_tier
ORDER BY total_value DESC;

Comparisons & Benchmarking

Compare performance across segments:

sql

-- Compare this month vs last month
SELECT
  EXTRACT(MONTH FROM created_at) as month,
  EXTRACT(YEAR FROM created_at) as year,
  COUNT(*) as sales_count,
  SUM(amount) as revenue
FROM sales
WHERE created_at > NOW() - INTERVAL '2 months'
GROUP BY EXTRACT(YEAR FROM created_at), EXTRACT(MONTH FROM created_at)
ORDER BY year DESC, month DESC;

Ranking & Top-N Analysis

Find your best and worst performers:

sql

-- Top 10 products by revenue
SELECT
  product_name,
  SUM(quantity * price) as revenue,
  COUNT(*) as order_count,
  ROW_NUMBER() OVER (ORDER BY SUM(quantity * price) DESC) as rank
FROM order_items
GROUP BY product_name
ORDER BY rank
LIMIT 10;

Joins for Cross-Table Analysis

Combine data from multiple tables:

sql

-- Customers with their order summary
SELECT
  c.customer_id,
  c.customer_name,
  COUNT(o.order_id) as total_orders,
  SUM(o.order_total) as lifetime_value,
  MAX(o.created_at) as last_order_date
FROM customers c
LEFT JOIN orders o ON c.customer_id = o.customer_id
GROUP BY c.customer_id, c.customer_name
ORDER BY lifetime_value DESC;

This pattern combines customer data with their order history in a single view.

Window Functions for Context

Calculate metrics while maintaining row detail:

sql

-- Orders with running total and percentile rank
SELECT
  order_id,
  amount,
  SUM(amount) OVER (ORDER BY created_at) as running_total,
  PERCENT_RANK() OVER (ORDER BY amount) * 100 as percentile
FROM orders
WHERE created_at > '2024-01-01'
ORDER BY created_at DESC;

Window functions let you see individual records alongside aggregate metrics—perfect for context.

Exporting Analysis Results

Once you have your analysis, export the data for sharing or further processing:

Analysis Best Practices

Troubleshooting Common Analysis Issues

Advanced Analysis Scenarios

Scenario 1: Churn Analysis

Identify which customers are at risk of leaving:

sql

-- Customers who haven't ordered recently
SELECT
  c.customer_id,
  c.customer_name,
  MAX(o.created_at) as last_order_date,
  NOW() - MAX(o.created_at) as days_since_order,
  COUNT(o.order_id) as lifetime_orders,
  SUM(o.amount) as lifetime_value
FROM customers c
LEFT JOIN orders o ON c.customer_id = o.customer_id
GROUP BY c.customer_id, c.customer_name
HAVING MAX(o.created_at) < NOW() - INTERVAL '90 days'
ORDER BY days_since_order DESC;

Export these results to a customer success team for re-engagement campaigns.

Scenario 2: Data Quality Audit

Find data anomalies and quality issues:

sql

-- Records with potential quality issues
SELECT
  *,
  CASE
    WHEN email NOT LIKE '%@%.%' THEN 'Invalid email'
    WHEN phone_number IS NULL THEN 'Missing phone'
    WHEN created_at > NOW() THEN 'Future date'
    WHEN length(first_name) > 50 THEN 'Suspiciously long name'
    ELSE 'OK'
  END as quality_issue
FROM users
WHERE
  email NOT LIKE '%@%.%'
  OR phone_number IS NULL
  OR created_at > NOW()
  OR length(first_name) > 50
ORDER BY created_at DESC;

Export and share with the data team to fix underlying data entry processes.

Scenario 3: Cohort Retention

Track how user retention changes by signup cohort:

sql

WITH cohorts AS (
  SELECT
    user_id,
    DATE_TRUNC('month', created_at)::date as signup_month
  FROM users
),
activity AS (
  SELECT
    user_id,
    DATE_TRUNC('month', activity_date)::date as activity_month
  FROM user_activity
)
SELECT
  c.signup_month,
  EXTRACT(MONTH FROM a.activity_month - c.signup_month) as months_since_signup,
  COUNT(DISTINCT c.user_id) as active_users
FROM cohorts c
LEFT JOIN activity a ON c.user_id = a.user_id
GROUP BY c.signup_month, months_since_signup
ORDER BY c.signup_month DESC, months_since_signup;

This shows whether newer cohorts have better or worse retention than historical cohorts.

Next Steps

Now that you're confident with data analysis, explore:

Testing & Development

Use these same techniques with generated mock data

Database Exploration

Explore new datasets before analyzing them

Query Reference

Master advanced SQL techniques

Export Options

Learn export customization in depth