Spaces:
Sleeping
Sleeping
Commit ·
90aa4a4
1
Parent(s): 1454e23
Fix task 6 month format and task 8 rounding
Browse files
main.py
CHANGED
|
@@ -133,7 +133,8 @@ TASKS = {
|
|
| 133 |
"description": (
|
| 134 |
"Calculate the month-over-month revenue growth percentage for completed orders in 2024. "
|
| 135 |
"For each month show total revenue and percentage change vs previous month. "
|
| 136 |
-
|
|
|
|
| 137 |
"Order by month ascending. Round growth_pct to 2 decimal places. "
|
| 138 |
"For the first month, prev_revenue and growth_pct should be NULL."
|
| 139 |
),
|
|
@@ -141,7 +142,7 @@ TASKS = {
|
|
| 141 |
"hint": "Use LAG() window function to get previous month revenue, then calculate (current - prev) / prev * 100",
|
| 142 |
"answer_query": """
|
| 143 |
WITH monthly AS (
|
| 144 |
-
SELECT STRFTIME('%m', order_date) AS month,
|
| 145 |
ROUND(SUM(total_amount), 2) AS total_revenue
|
| 146 |
FROM orders
|
| 147 |
WHERE status = 'completed'
|
|
|
|
| 133 |
"description": (
|
| 134 |
"Calculate the month-over-month revenue growth percentage for completed orders in 2024. "
|
| 135 |
"For each month show total revenue and percentage change vs previous month. "
|
| 136 |
+
"Return columns: month, total_revenue, prev_revenue, growth_pct. "
|
| 137 |
+
"Format month as YYYY-MM (e.g. 2024-01). "
|
| 138 |
"Order by month ascending. Round growth_pct to 2 decimal places. "
|
| 139 |
"For the first month, prev_revenue and growth_pct should be NULL."
|
| 140 |
),
|
|
|
|
| 142 |
"hint": "Use LAG() window function to get previous month revenue, then calculate (current - prev) / prev * 100",
|
| 143 |
"answer_query": """
|
| 144 |
WITH monthly AS (
|
| 145 |
+
SELECT STRFTIME('%Y-%m', order_date) AS month,
|
| 146 |
ROUND(SUM(total_amount), 2) AS total_revenue
|
| 147 |
FROM orders
|
| 148 |
WHERE status = 'completed'
|