SQL Playground - Finance Demo

How to use this:

1. Click Run Query to run the starter query.
2. Change the date range or customer name and run it again.
3. Try one of the example queries below.
4. This playground is read-only for learners.

Available tables:

Beginner-friendly view: sales_data_flat


Loading database...
Results
Starter Queries
SELECT * FROM sales_data_flat LIMIT 10;
SELECT
    customer_name,
    SUM(revenue) AS total_revenue
FROM sales_data_flat
WHERE sale_date BETWEEN '2024-01-01' AND '2024-01-31'
GROUP BY customer_name
ORDER BY total_revenue DESC;
SELECT
    customer_name,
    SUM(revenue) AS total_revenue
FROM sales_data_flat
WHERE sale_date BETWEEN '2024-01-01' AND '2024-01-31'
  AND customer_name = 'Southern Retail Group'
GROUP BY customer_name;
SELECT
    p.product_category,
    SUM(s.revenue) AS total_revenue
FROM sales s
JOIN products p
  ON s.product_id = p.product_id
GROUP BY p.product_category
ORDER BY total_revenue DESC;