id stringlengths 8 8 | db_id stringlengths 2 28 | SQL stringclasses 24 values | question stringlengths 56 837 | difficulty float64 | tables stringlengths 45 658 | prompt stringlengths 615 1.69k |
|---|---|---|---|---|---|---|
local002 | E_commerce | null | Can you calculate the 5-day symmetric moving average of predicted toy sales for December 5 to 8, 2018, using daily sales data from January 1, 2017, to August 29, 2018, with a simple linear regression model? Finally provide the sum of those four 5-day moving averages? | null | ['product_category_name_translation' 'sellers' 'customers' 'geolocation'
'order_items' 'order_payments' 'order_reviews' 'orders' 'products'
'leads_qualified' 'leads_closed'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: E_commerce
2. **Tables**: product_category_name_translation, sellers, customers, geolocation, order_items, order_payments, order_reviews, orders, products, leads_qualified, leads_closed
3. **User Question**: Can you calculate the 5-day symmetric moving average of predicted toy sales for December 5 to 8, 2018, using daily sales data from January 1, 2017, to August 29, 2018, with a simple linear regression model? Finally provide the sum of those four 5-day moving averages?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local003 | E_commerce | WITH RecencyScore AS (
SELECT customer_unique_id,
MAX(order_purchase_timestamp) AS last_purchase,
NTILE(5) OVER (ORDER BY MAX(order_purchase_timestamp) DESC) AS recency
FROM orders
JOIN customers USING (customer_id)
WHERE order_status = 'delivered'
GROUP BY customer_unique_id
),
FrequencyScore AS (
SELECT customer_unique_id,
COUNT(order_id) AS total_orders,
NTILE(5) OVER (ORDER BY COUNT(order_id) DESC) AS frequency
FROM orders
JOIN customers USING (customer_id)
WHERE order_status = 'delivered'
GROUP BY customer_unique_id
),
MonetaryScore AS (
SELECT customer_unique_id,
SUM(price) AS total_spent,
NTILE(5) OVER (ORDER BY SUM(price) DESC) AS monetary
FROM orders
JOIN order_items USING (order_id)
JOIN customers USING (customer_id)
WHERE order_status = 'delivered'
GROUP BY customer_unique_id
),
-- 2. Assign each customer to a group
RFM AS (
SELECT last_purchase, total_orders, total_spent,
CASE
WHEN recency = 1 AND frequency + monetary IN (1, 2, 3, 4) THEN "Champions"
WHEN recency IN (4, 5) AND frequency + monetary IN (1, 2) THEN "Can't Lose Them"
WHEN recency IN (4, 5) AND frequency + monetary IN (3, 4, 5, 6) THEN "Hibernating"
WHEN recency IN (4, 5) AND frequency + monetary IN (7, 8, 9, 10) THEN "Lost"
WHEN recency IN (2, 3) AND frequency + monetary IN (1, 2, 3, 4) THEN "Loyal Customers"
WHEN recency = 3 AND frequency + monetary IN (5, 6) THEN "Needs Attention"
WHEN recency = 1 AND frequency + monetary IN (7, 8) THEN "Recent Users"
WHEN recency = 1 AND frequency + monetary IN (5, 6) OR
recency = 2 AND frequency + monetary IN (5, 6, 7, 8) THEN "Potentital Loyalists"
WHEN recency = 1 AND frequency + monetary IN (9, 10) THEN "Price Sensitive"
WHEN recency = 2 AND frequency + monetary IN (9, 10) THEN "Promising"
WHEN recency = 3 AND frequency + monetary IN (7, 8, 9, 10) THEN "About to Sleep"
END AS RFM_Bucket
FROM RecencyScore
JOIN FrequencyScore USING (customer_unique_id)
JOIN MonetaryScore USING (customer_unique_id)
)
SELECT RFM_Bucket,
AVG(total_spent / total_orders) AS avg_sales_per_customer
FROM RFM
GROUP BY RFM_Bucket | According to the RFM definition document, calculate the average sales per order for each customer within distinct RFM segments, considering only 'delivered' orders. Use the customer unique identifier. Clearly define how to calculate Recency based on the latest purchase timestamp and specify the criteria for classifying RFM segments. The average sales should be computed as the total spend divided by the total number of orders. Please analyze and report the differences in average sales across the RFM segments | null | ['product_category_name_translation' 'sellers' 'customers' 'geolocation'
'order_items' 'order_payments' 'order_reviews' 'orders' 'products'
'leads_qualified' 'leads_closed'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: E_commerce
2. **Tables**: product_category_name_translation, sellers, customers, geolocation, order_items, order_payments, order_reviews, orders, products, leads_qualified, leads_closed
3. **User Question**: According to the RFM definition document, calculate the average sales per order for each customer within distinct RFM segments, considering only 'delivered' orders. Use the customer unique identifier. Clearly define how to calculate Recency based on the latest purchase timestamp and specify the criteria for classifying RFM segments. The average sales should be computed as the total spend divided by the total number of orders. Please analyze and report the differences in average sales across the RFM segments
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local004 | E_commerce | WITH CustomerData AS (
SELECT
customer_unique_id,
COUNT(DISTINCT orders.order_id) AS order_count,
SUM(payment_value) AS total_payment,
JULIANDAY(MIN(order_purchase_timestamp)) AS first_order_day,
JULIANDAY(MAX(order_purchase_timestamp)) AS last_order_day
FROM customers
JOIN orders USING (customer_id)
JOIN order_payments USING (order_id)
GROUP BY customer_unique_id
)
SELECT
customer_unique_id,
order_count AS PF,
ROUND(total_payment / order_count, 2) AS AOV,
CASE
WHEN (last_order_day - first_order_day) < 7 THEN
1
ELSE
(last_order_day - first_order_day) / 7
END AS ACL
FROM CustomerData
ORDER BY AOV DESC
LIMIT 3 | Could you tell me the number of orders, average payment per order and customer lifespan in weeks of the 3 custumers with the highest average payment per order, where the lifespan is calculated by subtracting the earliest purchase date from the latest purchase date in days, dividing by seven, and if the result is less than seven days, setting it to 1.0? | null | ['product_category_name_translation' 'sellers' 'customers' 'geolocation'
'order_items' 'order_payments' 'order_reviews' 'orders' 'products'
'leads_qualified' 'leads_closed'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: E_commerce
2. **Tables**: product_category_name_translation, sellers, customers, geolocation, order_items, order_payments, order_reviews, orders, products, leads_qualified, leads_closed
3. **User Question**: Could you tell me the number of orders, average payment per order and customer lifespan in weeks of the 3 custumers with the highest average payment per order, where the lifespan is calculated by subtracting the earliest purchase date from the latest purchase date in days, dividing by seven, and if the result is less than seven days, setting it to 1.0?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local007 | Baseball | null | Could you help me calculate the average single career span value in years for all baseball players? Please precise the result as a float number. First, calculate the difference in years, months, and days between the debut and final game dates. For each player, the career span is computed as the sum of the absolute number of years, plus the absolute number of months divided by 12, plus the absolute number of days divided by 365. Round each part to two decimal places before summing. Finally, average the career spans and round the result to a float number. | null | ['all_star' 'appearances' 'manager_award' 'player_award'
'manager_award_vote' 'player_award_vote' 'batting' 'batting_postseason'
'player_college' 'fielding' 'fielding_outfield' 'fielding_postseason'
'hall_of_fame' 'home_game' 'manager' 'manager_half' 'player' 'park'
'pitching' 'pitching_postseason' 'salary' 'college' 'postseason' 'team'
'team_franchise' 'team_half'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Baseball
2. **Tables**: all_star, appearances, manager_award, player_award, manager_award_vote, player_award_vote, batting, batting_postseason, player_college, fielding, fielding_outfield, fielding_postseason, hall_of_fame, home_game, manager, manager_half, player, park, pitching, pitching_postseason, salary, college, postseason, team, team_franchise, team_half
3. **User Question**: Could you help me calculate the average single career span value in years for all baseball players? Please precise the result as a float number. First, calculate the difference in years, months, and days between the debut and final game dates. For each player, the career span is computed as the sum of the absolute number of years, plus the absolute number of months divided by 12, plus the absolute number of days divided by 365. Round each part to two decimal places before summing. Finally, average the career spans and round the result to a float number.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local008 | Baseball | WITH player_stats AS (
SELECT
b.player_id,
p.name_given AS player_name,
SUM(b.g) AS games_played,
SUM(b.r) AS runs,
SUM(b.h) AS hits,
SUM(b.hr) AS home_runs
FROM player p
JOIN batting b ON p.player_id = b.player_id
GROUP BY b.player_id, p.name_given
)
SELECT 'Games Played' AS Category, player_name AS Player_Name, games_played AS Batting_Table_Topper
FROM player_stats
WHERE games_played = (SELECT MAX(games_played) FROM player_stats)
UNION ALL
SELECT 'Runs' AS Category, player_name AS Player_Name, runs AS Batting_Table_Topper
FROM player_stats
WHERE runs = (SELECT MAX(runs) FROM player_stats)
UNION ALL
SELECT 'Hits' AS Category, player_name AS Player_Name, hits AS Batting_Table_Topper
FROM player_stats
WHERE hits = (SELECT MAX(hits) FROM player_stats)
UNION ALL
SELECT 'Home Runs' AS Category, player_name AS Player_Name, home_runs AS Batting_Table_Topper
FROM player_stats
WHERE home_runs = (SELECT MAX(home_runs) FROM player_stats); | I would like to know the given names of baseball players who have achieved the highest value of games played, runs, hits, and home runs, with their corresponding score values. | null | ['all_star' 'appearances' 'manager_award' 'player_award'
'manager_award_vote' 'player_award_vote' 'batting' 'batting_postseason'
'player_college' 'fielding' 'fielding_outfield' 'fielding_postseason'
'hall_of_fame' 'home_game' 'manager' 'manager_half' 'player' 'park'
'pitching' 'pitching_postseason' 'salary' 'college' 'postseason' 'team'
'team_franchise' 'team_half'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Baseball
2. **Tables**: all_star, appearances, manager_award, player_award, manager_award_vote, player_award_vote, batting, batting_postseason, player_college, fielding, fielding_outfield, fielding_postseason, hall_of_fame, home_game, manager, manager_half, player, park, pitching, pitching_postseason, salary, college, postseason, team, team_franchise, team_half
3. **User Question**: I would like to know the given names of baseball players who have achieved the highest value of games played, runs, hits, and home runs, with their corresponding score values.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local009 | Airlines | null | What is the distance of the longest route where Abakan is either the departure or destination city (in kilometers)? | null | ['aircrafts_data' 'airports_data' 'boarding_passes' 'bookings' 'flights'
'seats' 'ticket_flights' 'tickets' 'city_map'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Airlines
2. **Tables**: aircrafts_data, airports_data, boarding_passes, bookings, flights, seats, ticket_flights, tickets, city_map
3. **User Question**: What is the distance of the longest route where Abakan is either the departure or destination city (in kilometers)?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local010 | Airlines | null | Distribute all the unique city pairs into the distance ranges 0, 1000, 2000, 3000, 4000, 5000, and 6000+, based on their average distance of all routes between them. Then how many pairs are there in the distance range with the fewest unique city paires? | null | ['aircrafts_data' 'airports_data' 'boarding_passes' 'bookings' 'flights'
'seats' 'ticket_flights' 'tickets' 'city_map'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Airlines
2. **Tables**: aircrafts_data, airports_data, boarding_passes, bookings, flights, seats, ticket_flights, tickets, city_map
3. **User Question**: Distribute all the unique city pairs into the distance ranges 0, 1000, 2000, 3000, 4000, 5000, and 6000+, based on their average distance of all routes between them. Then how many pairs are there in the distance range with the fewest unique city paires?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local015 | California_Traffic_Collision | null | Please calculate the fatality rate for motorcycle collisions, separated by helmet usage. Specifically, calculate two percentages: 1) the percentage of motorcyclist fatalities in collisions where parties (drivers or passengers) were wearing helmets, and 2) the percentage of motorcyclist fatalities in collisions where parties were not wearing helmets. For each group, compute this by dividing the total number of motorcyclist fatalities by the total number of collisions involving that group. Use the parties table to determine helmet usage (from party_safety_equipment fields). | null | ['victims' 'collisions' 'case_ids' 'parties'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: California_Traffic_Collision
2. **Tables**: victims, collisions, case_ids, parties
3. **User Question**: Please calculate the fatality rate for motorcycle collisions, separated by helmet usage. Specifically, calculate two percentages: 1) the percentage of motorcyclist fatalities in collisions where parties (drivers or passengers) were wearing helmets, and 2) the percentage of motorcyclist fatalities in collisions where parties were not wearing helmets. For each group, compute this by dividing the total number of motorcyclist fatalities by the total number of collisions involving that group. Use the parties table to determine helmet usage (from party_safety_equipment fields).
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local017 | California_Traffic_Collision | WITH AnnualTotals AS (
SELECT
STRFTIME('%Y', collision_date) AS Year,
COUNT(case_id) AS AnnualTotal
FROM
collisions
GROUP BY
Year
),
CategoryTotals AS (
SELECT
STRFTIME('%Y', collision_date) AS Year,
pcf_violation_category AS Category,
COUNT(case_id) AS Subtotal
FROM
collisions
GROUP BY
Year, Category
),
CategoryPercentages AS (
SELECT
ct.Year,
ct.Category,
ROUND((ct.Subtotal * 100.0) / at.AnnualTotal, 1) AS PercentageOfAnnualRoadIncidents
FROM
CategoryTotals ct
JOIN
AnnualTotals at ON ct.Year = at.Year
),
RankedCategories AS (
SELECT
Year,
Category,
PercentageOfAnnualRoadIncidents,
ROW_NUMBER() OVER (PARTITION BY Year ORDER BY PercentageOfAnnualRoadIncidents DESC) AS Rank
FROM
CategoryPercentages
),
TopTwoCategories AS (
SELECT
Year,
GROUP_CONCAT(Category, ', ') AS TopCategories
FROM
RankedCategories
WHERE
Rank <= 2
GROUP BY
Year
),
UniqueYear AS (
SELECT
Year
FROM
TopTwoCategories
GROUP BY
TopCategories
HAVING COUNT(Year) = 1
),
results AS (
SELECT
rc.Year,
rc.Category,
rc.PercentageOfAnnualRoadIncidents
FROM
UniqueYear u
JOIN
RankedCategories rc ON u.Year = rc.Year
WHERE
rc.Rank <= 2
)
SELECT distinct Year FROM results | In which year were the two most common causes of traffic accidents different from those in other years? | null | ['victims' 'collisions' 'case_ids' 'parties'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: California_Traffic_Collision
2. **Tables**: victims, collisions, case_ids, parties
3. **User Question**: In which year were the two most common causes of traffic accidents different from those in other years?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local018 | California_Traffic_Collision | null | For the primary collision factor violation category that was the most common cause of traffic accidents in 2021, how many percentage points did its share of annual road incidents in 2021 decrease compared to its share in 2011? | null | ['victims' 'collisions' 'case_ids' 'parties'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: California_Traffic_Collision
2. **Tables**: victims, collisions, case_ids, parties
3. **User Question**: For the primary collision factor violation category that was the most common cause of traffic accidents in 2021, how many percentage points did its share of annual road incidents in 2021 decrease compared to its share in 2011?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local019 | WWE | WITH MatchDetails AS (
SELECT
b.name AS titles,
m.duration AS match_duration,
w1.name || ' vs ' || w2.name AS matches,
m.win_type AS win_type,
l.name AS location,
e.name AS event,
ROW_NUMBER() OVER (PARTITION BY b.name ORDER BY m.duration ASC) AS rank
FROM
Belts b
INNER JOIN Matches m ON m.title_id = b.id
INNER JOIN Wrestlers w1 ON w1.id = m.winner_id
INNER JOIN Wrestlers w2 ON w2.id = m.loser_id
INNER JOIN Cards c ON c.id = m.card_id
INNER JOIN Locations l ON l.id = c.location_id
INNER JOIN Events e ON e.id = c.event_id
INNER JOIN Promotions p ON p.id = c.promotion_id
WHERE
p.name = 'NXT'
AND m.duration <> ''
AND b.name <> ''
AND b.name NOT IN (
SELECT name
FROM Belts
WHERE name LIKE '%title change%'
)
),
Rank1 AS (
SELECT
titles,
match_duration,
matches,
win_type,
location,
event
FROM
MatchDetails
WHERE
rank = 1
)
SELECT
SUBSTR(matches, 1, INSTR(matches, ' vs ') - 1) AS wrestler1,
SUBSTR(matches, INSTR(matches, ' vs ') + 4) AS wrestler2
FROM
Rank1
ORDER BY match_duration
LIMIT 1 | For the NXT title that had the shortest match (excluding titles with "title change"), what were the names of the two wrestlers involved? | null | ['Promotions' 'sqlite_sequence' 'Tables' 'Cards' 'Locations' 'Events'
'Matches' 'Belts' 'Wrestlers' 'Match_Types'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: WWE
2. **Tables**: Promotions, sqlite_sequence, Tables, Cards, Locations, Events, Matches, Belts, Wrestlers, Match_Types
3. **User Question**: For the NXT title that had the shortest match (excluding titles with "title change"), what were the names of the two wrestlers involved?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local026 | IPL | null | Please help me identify the top 3 bowlers who, in the overs where the maximum runs were conceded in each match, gave up the highest number of runs in a single over across all matches. For each of these bowlers, provide the match in which they conceded these maximum runs. Only consider overs that had the most runs conceded within their respective matches, and among these, determine which bowlers conceded the most runs in a single over overall. | null | ['player' 'team' 'match' 'player_match' 'ball_by_ball' 'batsman_scored'
'wicket_taken' 'extra_runs' 'delivery'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: IPL
2. **Tables**: player, team, match, player_match, ball_by_ball, batsman_scored, wicket_taken, extra_runs, delivery
3. **User Question**: Please help me identify the top 3 bowlers who, in the overs where the maximum runs were conceded in each match, gave up the highest number of runs in a single over across all matches. For each of these bowlers, provide the match in which they conceded these maximum runs. Only consider overs that had the most runs conceded within their respective matches, and among these, determine which bowlers conceded the most runs in a single over overall.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local020 | IPL | null | Which bowler has the lowest bowling average per wicket taken? | null | ['player' 'team' 'match' 'player_match' 'ball_by_ball' 'batsman_scored'
'wicket_taken' 'extra_runs' 'delivery'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: IPL
2. **Tables**: player, team, match, player_match, ball_by_ball, batsman_scored, wicket_taken, extra_runs, delivery
3. **User Question**: Which bowler has the lowest bowling average per wicket taken?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local021 | IPL | null | Could you calculate the average of the total runs scored by all strikers who have scored more than 50 runs in any single match? | null | ['player' 'team' 'match' 'player_match' 'ball_by_ball' 'batsman_scored'
'wicket_taken' 'extra_runs' 'delivery'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: IPL
2. **Tables**: player, team, match, player_match, ball_by_ball, batsman_scored, wicket_taken, extra_runs, delivery
3. **User Question**: Could you calculate the average of the total runs scored by all strikers who have scored more than 50 runs in any single match?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local022 | IPL | -- Step 1: Calculate players' total runs in each match
WITH player_runs AS (
SELECT
bbb.striker AS player_id,
bbb.match_id,
SUM(bsc.runs_scored) AS total_runs
FROM
ball_by_ball AS bbb
JOIN
batsman_scored AS bsc
ON
bbb.match_id = bsc.match_id
AND bbb.over_id = bsc.over_id
AND bbb.ball_id = bsc.ball_id
AND bbb.innings_no = bsc.innings_no
GROUP BY
bbb.striker, bbb.match_id
HAVING
SUM(bsc.runs_scored) >= 100
),
-- Step 2: Identify losing teams for each match
losing_teams AS (
SELECT
match_id,
CASE
WHEN match_winner = team_1 THEN team_2
ELSE team_1
END AS loser
FROM
match
),
-- Step 3: Combine the above results to get players who scored 100 or more runs in losing teams
players_in_losing_teams AS (
SELECT
pr.player_id,
pr.match_id
FROM
player_runs AS pr
JOIN
losing_teams AS lt
ON
pr.match_id = lt.match_id
JOIN
player_match AS pm
ON
pr.player_id = pm.player_id
AND pr.match_id = pm.match_id
AND lt.loser = pm.team_id
)
-- Step 4: Select distinct player names from the player table
SELECT DISTINCT
p.player_name
FROM
player AS p
JOIN
players_in_losing_teams AS plt
ON
p.player_id = plt.player_id
ORDER BY
p.player_name; | Retrieve the names of players who scored no less than 100 runs in a match while playing for the team that lost that match. | null | ['player' 'team' 'match' 'player_match' 'ball_by_ball' 'batsman_scored'
'wicket_taken' 'extra_runs' 'delivery'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: IPL
2. **Tables**: player, team, match, player_match, ball_by_ball, batsman_scored, wicket_taken, extra_runs, delivery
3. **User Question**: Retrieve the names of players who scored no less than 100 runs in a match while playing for the team that lost that match.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local023 | IPL | WITH runs_scored AS (
SELECT
bb.striker AS player_id,
bb.match_id,
bs.runs_scored AS runs
FROM
ball_by_ball AS bb
JOIN
batsman_scored AS bs ON bb.match_id = bs.match_id
AND bb.over_id = bs.over_id
AND bb.ball_id = bs.ball_id
AND bb.innings_no = bs.innings_no
WHERE
bb.match_id IN (SELECT match_id FROM match WHERE season_id = 5)
),
total_runs AS (
SELECT
player_id,
match_id,
SUM(runs) AS total_runs
FROM
runs_scored
GROUP BY
player_id, match_id
),
batting_averages AS (
SELECT
player_id,
SUM(total_runs) AS runs,
COUNT(match_id) AS num_matches,
ROUND(SUM(total_runs) / CAST(COUNT(match_id) AS FLOAT), 3) AS batting_avg
FROM
total_runs
GROUP BY
player_id
ORDER BY
batting_avg DESC
LIMIT 5
)
SELECT
p.player_name,
b.batting_avg
FROM
player AS p
JOIN
batting_averages AS b ON p.player_id = b.player_id
ORDER BY
b.batting_avg DESC; | Please help me find the names of top 5 players with the highest average runs per match in season 5, along with their batting averages. | null | ['player' 'team' 'match' 'player_match' 'ball_by_ball' 'batsman_scored'
'wicket_taken' 'extra_runs' 'delivery'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: IPL
2. **Tables**: player, team, match, player_match, ball_by_ball, batsman_scored, wicket_taken, extra_runs, delivery
3. **User Question**: Please help me find the names of top 5 players with the highest average runs per match in season 5, along with their batting averages.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local024 | IPL | null | Can you help me find the top 5 countries whose players have the highest average of their individual average runs per match across all seasons? Specifically, for each player, calculate their average runs per match over all matches they played, then compute the average of these player averages for each country, and include these country batting averages in the result. | null | ['player' 'team' 'match' 'player_match' 'ball_by_ball' 'batsman_scored'
'wicket_taken' 'extra_runs' 'delivery'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: IPL
2. **Tables**: player, team, match, player_match, ball_by_ball, batsman_scored, wicket_taken, extra_runs, delivery
3. **User Question**: Can you help me find the top 5 countries whose players have the highest average of their individual average runs per match across all seasons? Specifically, for each player, calculate their average runs per match over all matches they played, then compute the average of these player averages for each country, and include these country batting averages in the result.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local025 | IPL | null | For each match, considering every innings, please combine runs from both batsman scored and extra runs for each over, then identify the single over with the highest total runs, retrieve the bowler for that over from the ball by ball table, and calculate the average of these highest over totals across all matches, ensuring that all runs and bowler details are accurately reflected. | null | ['player' 'team' 'match' 'player_match' 'ball_by_ball' 'batsman_scored'
'wicket_taken' 'extra_runs' 'delivery'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: IPL
2. **Tables**: player, team, match, player_match, ball_by_ball, batsman_scored, wicket_taken, extra_runs, delivery
3. **User Question**: For each match, considering every innings, please combine runs from both batsman scored and extra runs for each over, then identify the single over with the highest total runs, retrieve the bowler for that over from the ball by ball table, and calculate the average of these highest over totals across all matches, ensuring that all runs and bowler details are accurately reflected.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local028 | Brazilian_E_Commerce | null | Could you generate a report that shows the number of delivered orders for each month in the years 2016, 2017, and 2018? Each column represents a year, and each row represents a month | null | ['olist_customers' 'olist_sellers' 'olist_order_reviews'
'olist_order_items' 'olist_products' 'olist_geolocation'
'product_category_name_translation' 'olist_orders' 'olist_order_payments'
'olist_products_dataset'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Brazilian_E_Commerce
2. **Tables**: olist_customers, olist_sellers, olist_order_reviews, olist_order_items, olist_products, olist_geolocation, product_category_name_translation, olist_orders, olist_order_payments, olist_products_dataset
3. **User Question**: Could you generate a report that shows the number of delivered orders for each month in the years 2016, 2017, and 2018? Each column represents a year, and each row represents a month
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local031 | Brazilian_E_Commerce | null | What is the highest monthly delivered orders volume in the year with the lowest annual delivered orders volume among 2016, 2017, and 2018? | null | ['olist_customers' 'olist_sellers' 'olist_order_reviews'
'olist_order_items' 'olist_products' 'olist_geolocation'
'product_category_name_translation' 'olist_orders' 'olist_order_payments'
'olist_products_dataset'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Brazilian_E_Commerce
2. **Tables**: olist_customers, olist_sellers, olist_order_reviews, olist_order_items, olist_products, olist_geolocation, product_category_name_translation, olist_orders, olist_order_payments, olist_products_dataset
3. **User Question**: What is the highest monthly delivered orders volume in the year with the lowest annual delivered orders volume among 2016, 2017, and 2018?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local029 | Brazilian_E_Commerce | WITH customer_orders AS (
SELECT
c.customer_unique_id,
COUNT(o.order_id) AS Total_Orders_By_Customers,
AVG(p.payment_value) AS Average_Payment_By_Customer,
c.customer_city,
c.customer_state
FROM olist_customers c
JOIN olist_orders o ON c.customer_id = o.customer_id
JOIN olist_order_payments p ON o.order_id = p.order_id
WHERE o.order_status = 'delivered'
GROUP BY c.customer_unique_id, c.customer_city, c.customer_state
)
SELECT
Average_Payment_By_Customer,
customer_city,
customer_state
FROM customer_orders
ORDER BY Total_Orders_By_Customers DESC
LIMIT 3; | Please identify the top three customers, based on their customer_unique_id, who have the highest number of delivered orders, and provide the average payment value, city, and state for each of these customers. | null | ['olist_customers' 'olist_sellers' 'olist_order_reviews'
'olist_order_items' 'olist_products' 'olist_geolocation'
'product_category_name_translation' 'olist_orders' 'olist_order_payments'
'olist_products_dataset'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Brazilian_E_Commerce
2. **Tables**: olist_customers, olist_sellers, olist_order_reviews, olist_order_items, olist_products, olist_geolocation, product_category_name_translation, olist_orders, olist_order_payments, olist_products_dataset
3. **User Question**: Please identify the top three customers, based on their customer_unique_id, who have the highest number of delivered orders, and provide the average payment value, city, and state for each of these customers.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local030 | Brazilian_E_Commerce | null | Among all cities with delivered orders, find the five cities whose summed payments are the lowest, then calculate the average of their total payments and the average of their total delivered order counts. | null | ['olist_customers' 'olist_sellers' 'olist_order_reviews'
'olist_order_items' 'olist_products' 'olist_geolocation'
'product_category_name_translation' 'olist_orders' 'olist_order_payments'
'olist_products_dataset'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Brazilian_E_Commerce
2. **Tables**: olist_customers, olist_sellers, olist_order_reviews, olist_order_items, olist_products, olist_geolocation, product_category_name_translation, olist_orders, olist_order_payments, olist_products_dataset
3. **User Question**: Among all cities with delivered orders, find the five cities whose summed payments are the lowest, then calculate the average of their total payments and the average of their total delivered order counts.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local032 | Brazilian_E_Commerce | null | Could you help me find the sellers who excel in the following categories, considering only delivered orders: the seller with the highest number of distinct customer unique IDs, the seller with the highest profit (calculated as price minus freight value), the seller with the highest number of distinct orders, and the seller with the most 5-star ratings? For each category, please provide the seller ID and the corresponding value, labeling each row with a description of the achievement. | null | ['olist_customers' 'olist_sellers' 'olist_order_reviews'
'olist_order_items' 'olist_products' 'olist_geolocation'
'product_category_name_translation' 'olist_orders' 'olist_order_payments'
'olist_products_dataset'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Brazilian_E_Commerce
2. **Tables**: olist_customers, olist_sellers, olist_order_reviews, olist_order_items, olist_products, olist_geolocation, product_category_name_translation, olist_orders, olist_order_payments, olist_products_dataset
3. **User Question**: Could you help me find the sellers who excel in the following categories, considering only delivered orders: the seller with the highest number of distinct customer unique IDs, the seller with the highest profit (calculated as price minus freight value), the seller with the highest number of distinct orders, and the seller with the most 5-star ratings? For each category, please provide the seller ID and the corresponding value, labeling each row with a description of the achievement.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local034 | Brazilian_E_Commerce | null | Could you help me calculate the average of the total number of payments made using the most preferred payment method for each product category, where the most preferred payment method in a category is the one with the highest number of payments? | null | ['olist_customers' 'olist_sellers' 'olist_order_reviews'
'olist_order_items' 'olist_products' 'olist_geolocation'
'product_category_name_translation' 'olist_orders' 'olist_order_payments'
'olist_products_dataset'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Brazilian_E_Commerce
2. **Tables**: olist_customers, olist_sellers, olist_order_reviews, olist_order_items, olist_products, olist_geolocation, product_category_name_translation, olist_orders, olist_order_payments, olist_products_dataset
3. **User Question**: Could you help me calculate the average of the total number of payments made using the most preferred payment method for each product category, where the most preferred payment method in a category is the one with the highest number of payments?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local037 | Brazilian_E_Commerce | null | Identify the top three product categories whose most commonly used payment type has the highest number of payments across all categories, and specify the number of payments made in each category using that payment type. | null | ['olist_customers' 'olist_sellers' 'olist_order_reviews'
'olist_order_items' 'olist_products' 'olist_geolocation'
'product_category_name_translation' 'olist_orders' 'olist_order_payments'
'olist_products_dataset'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Brazilian_E_Commerce
2. **Tables**: olist_customers, olist_sellers, olist_order_reviews, olist_order_items, olist_products, olist_geolocation, product_category_name_translation, olist_orders, olist_order_payments, olist_products_dataset
3. **User Question**: Identify the top three product categories whose most commonly used payment type has the highest number of payments across all categories, and specify the number of payments made in each category using that payment type.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local035 | Brazilian_E_Commerce | null | In the “olist_geolocation” table, please identify which two consecutive cities, when sorted by geolocation_state, geolocation_city, geolocation_zip_code_prefix, geolocation_lat, and geolocation_lng, have the greatest distance between them based on the difference in distance computed between each city and its immediate predecessor in that ordering. | null | ['olist_customers' 'olist_sellers' 'olist_order_reviews'
'olist_order_items' 'olist_products' 'olist_geolocation'
'product_category_name_translation' 'olist_orders' 'olist_order_payments'
'olist_products_dataset'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Brazilian_E_Commerce
2. **Tables**: olist_customers, olist_sellers, olist_order_reviews, olist_order_items, olist_products, olist_geolocation, product_category_name_translation, olist_orders, olist_order_payments, olist_products_dataset
3. **User Question**: In the “olist_geolocation” table, please identify which two consecutive cities, when sorted by geolocation_state, geolocation_city, geolocation_zip_code_prefix, geolocation_lat, and geolocation_lng, have the greatest distance between them based on the difference in distance computed between each city and its immediate predecessor in that ordering.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local038 | Pagila | SELECT
actor.first_name || ' ' || actor.last_name AS full_name
FROM
actor
INNER JOIN film_actor ON actor.actor_id = film_actor.actor_id
INNER JOIN film ON film_actor.film_id = film.film_id
INNER JOIN film_category ON film.film_id = film_category.film_id
INNER JOIN category ON film_category.category_id = category.category_id
-- Join with the language table
INNER JOIN language ON film.language_id = language.language_id
WHERE
category.name = 'Children' AND
film.release_year BETWEEN 2000 AND 2010 AND
film.rating IN ('G', 'PG') AND
language.name = 'English' AND
film.length <= 120
GROUP BY
actor.actor_id, actor.first_name, actor.last_name
ORDER BY
COUNT(film.film_id) DESC
LIMIT 1; | Could you help me determine which actor starred most frequently in English-language children's category films that were rated either G or PG, had a running time of 120 minutes or less, and were released between 2000 and 2010? Please provide the actor's full name. | null | ['actor' 'country' 'city' 'address' 'language' 'category' 'customer'
'film' 'film_actor' 'film_category' 'film_text' 'inventory' 'staff'
'store' 'payment' 'rental'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Pagila
2. **Tables**: actor, country, city, address, language, category, customer, film, film_actor, film_category, film_text, inventory, staff, store, payment, rental
3. **User Question**: Could you help me determine which actor starred most frequently in English-language children's category films that were rated either G or PG, had a running time of 120 minutes or less, and were released between 2000 and 2010? Please provide the actor's full name.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local039 | Pagila | SELECT
category.name
FROM
category
INNER JOIN film_category USING (category_id)
INNER JOIN film USING (film_id)
INNER JOIN inventory USING (film_id)
INNER JOIN rental USING (inventory_id)
INNER JOIN customer USING (customer_id)
INNER JOIN address USING (address_id)
INNER JOIN city USING (city_id)
WHERE
LOWER(city.city) LIKE 'a%' OR city.city LIKE '%-%'
GROUP BY
category.name
ORDER BY
SUM(CAST((julianday(rental.return_date) - julianday(rental.rental_date)) * 24 AS INTEGER)) DESC
LIMIT
1; | Please help me find the film category with the highest total rental hours in cities where the city's name either starts with "A" or contains a hyphen. | null | ['actor' 'country' 'city' 'address' 'language' 'category' 'customer'
'film' 'film_actor' 'film_category' 'film_text' 'inventory' 'staff'
'store' 'payment' 'rental'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Pagila
2. **Tables**: actor, country, city, address, language, category, customer, film, film_actor, film_category, film_text, inventory, staff, store, payment, rental
3. **User Question**: Please help me find the film category with the highest total rental hours in cities where the city's name either starts with "A" or contains a hyphen.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local040 | modern_data | null | In the combined dataset that unifies the trees data with the income data by ZIP code, filling missing ZIP values where necessary, which three boroughs, restricted to records with median and mean income both greater than zero and a valid borough name, contain the highest number of trees, and what is the average mean income for each of these three boroughs? | null | ['pizza_names' 'companies_funding' 'pizza_customer_orders'
'pizza_toppings' 'trees' 'pizza_recipes' 'statistics' 'income_trees'
'pizza_clean_runner_orders' 'pizza_runner_orders' 'word_list'
'companies_dates' 'pizza_get_extras' 'pizza_get_exclusions'
'pizza_clean_customer_orders' 'companies_industries' 'pizza_runners'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: modern_data
2. **Tables**: pizza_names, companies_funding, pizza_customer_orders, pizza_toppings, trees, pizza_recipes, statistics, income_trees, pizza_clean_runner_orders, pizza_runner_orders, word_list, companies_dates, pizza_get_extras, pizza_get_exclusions, pizza_clean_customer_orders, companies_industries, pizza_runners
3. **User Question**: In the combined dataset that unifies the trees data with the income data by ZIP code, filling missing ZIP values where necessary, which three boroughs, restricted to records with median and mean income both greater than zero and a valid borough name, contain the highest number of trees, and what is the average mean income for each of these three boroughs?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local041 | modern_data | null | What percentage of trees in the Bronx have a health status of Good? | null | ['pizza_names' 'companies_funding' 'pizza_customer_orders'
'pizza_toppings' 'trees' 'pizza_recipes' 'statistics' 'income_trees'
'pizza_clean_runner_orders' 'pizza_runner_orders' 'word_list'
'companies_dates' 'pizza_get_extras' 'pizza_get_exclusions'
'pizza_clean_customer_orders' 'companies_industries' 'pizza_runners'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: modern_data
2. **Tables**: pizza_names, companies_funding, pizza_customer_orders, pizza_toppings, trees, pizza_recipes, statistics, income_trees, pizza_clean_runner_orders, pizza_runner_orders, word_list, companies_dates, pizza_get_extras, pizza_get_exclusions, pizza_clean_customer_orders, companies_industries, pizza_runners
3. **User Question**: What percentage of trees in the Bronx have a health status of Good?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local049 | modern_data | null | Can you help me calculate the average number of new unicorn companies per year in the top industry from 2019 to 2021? | null | ['pizza_names' 'companies_funding' 'pizza_customer_orders'
'pizza_toppings' 'trees' 'pizza_recipes' 'statistics' 'income_trees'
'pizza_clean_runner_orders' 'pizza_runner_orders' 'word_list'
'companies_dates' 'pizza_get_extras' 'pizza_get_exclusions'
'pizza_clean_customer_orders' 'companies_industries' 'pizza_runners'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: modern_data
2. **Tables**: pizza_names, companies_funding, pizza_customer_orders, pizza_toppings, trees, pizza_recipes, statistics, income_trees, pizza_clean_runner_orders, pizza_runner_orders, word_list, companies_dates, pizza_get_extras, pizza_get_exclusions, pizza_clean_customer_orders, companies_industries, pizza_runners
3. **User Question**: Can you help me calculate the average number of new unicorn companies per year in the top industry from 2019 to 2021?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local054 | chinook | null | Could you tell me the first names of customers who spent less than $1 on albums by the best-selling artist, along with the amounts they spent? | null | ['albums' 'sqlite_sequence' 'artists' 'customers' 'employees' 'genres'
'invoices' 'invoice_items' 'media_types' 'playlists' 'playlist_track'
'tracks' 'sqlite_stat1'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: chinook
2. **Tables**: albums, sqlite_sequence, artists, customers, employees, genres, invoices, invoice_items, media_types, playlists, playlist_track, tracks, sqlite_stat1
3. **User Question**: Could you tell me the first names of customers who spent less than $1 on albums by the best-selling artist, along with the amounts they spent?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local055 | chinook | null | Identify the artist with the highest overall sales of albums (tie broken by alphabetical order) and the artist with the lowest overall sales of albums (tie broken by alphabetical order), then calculate the amount each customer spent specifically on those two artists’ albums. Next, compute the average spending for the customers who purchased from the top-selling artist and the average spending for the customers who purchased from the lowest-selling artist, and finally return the absolute difference between these two averages. | null | ['albums' 'sqlite_sequence' 'artists' 'customers' 'employees' 'genres'
'invoices' 'invoice_items' 'media_types' 'playlists' 'playlist_track'
'tracks' 'sqlite_stat1'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: chinook
2. **Tables**: albums, sqlite_sequence, artists, customers, employees, genres, invoices, invoice_items, media_types, playlists, playlist_track, tracks, sqlite_stat1
3. **User Question**: Identify the artist with the highest overall sales of albums (tie broken by alphabetical order) and the artist with the lowest overall sales of albums (tie broken by alphabetical order), then calculate the amount each customer spent specifically on those two artists’ albums. Next, compute the average spending for the customers who purchased from the top-selling artist and the average spending for the customers who purchased from the lowest-selling artist, and finally return the absolute difference between these two averages.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local198 | chinook | null | Using the sales data, what is the median value of total sales made in countries where the number of customers is greater than 4? | null | ['albums' 'sqlite_sequence' 'artists' 'customers' 'employees' 'genres'
'invoices' 'invoice_items' 'media_types' 'playlists' 'playlist_track'
'tracks' 'sqlite_stat1'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: chinook
2. **Tables**: albums, sqlite_sequence, artists, customers, employees, genres, invoices, invoice_items, media_types, playlists, playlist_track, tracks, sqlite_stat1
3. **User Question**: Using the sales data, what is the median value of total sales made in countries where the number of customers is greater than 4?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local056 | sqlite-sakila | null | Which customer has the highest average monthly change in payment amounts? Provide the customer's full name. | null | ['actor' 'country' 'city' 'address' 'language' 'category' 'customer'
'film' 'film_actor' 'film_category' 'film_text' 'inventory' 'staff'
'store' 'payment' 'rental' 'monthly_payment_totals' 'MonthlyTotals'
'total_revenue_by_film'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: sqlite-sakila
2. **Tables**: actor, country, city, address, language, category, customer, film, film_actor, film_category, film_text, inventory, staff, store, payment, rental, monthly_payment_totals, MonthlyTotals, total_revenue_by_film
3. **User Question**: Which customer has the highest average monthly change in payment amounts? Provide the customer's full name.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local058 | education_business | WITH UniqueProducts2020 AS (
SELECT
dp.segment,
COUNT(DISTINCT fsm.product_code) AS unique_products_2020
FROM
hardware_fact_sales_monthly fsm
JOIN
hardware_dim_product dp ON fsm.product_code = dp.product_code
WHERE
fsm.fiscal_year = 2020
GROUP BY
dp.segment
),
UniqueProducts2021 AS (
SELECT
dp.segment,
COUNT(DISTINCT fsm.product_code) AS unique_products_2021
FROM
hardware_fact_sales_monthly fsm
JOIN
hardware_dim_product dp ON fsm.product_code = dp.product_code
WHERE
fsm.fiscal_year = 2021
GROUP BY
dp.segment
)
SELECT
spc.segment,
spc.unique_products_2020 AS product_count_2020
FROM
UniqueProducts2020 spc
JOIN
UniqueProducts2021 fup ON spc.segment = fup.segment
ORDER BY
((fup.unique_products_2021 - spc.unique_products_2020) * 100.0) / (spc.unique_products_2020) DESC; | Can you provide a list of hardware product segments along with their unique product counts for 2020 in the output, ordered by the highest percentage increase in unique fact sales products from 2020 to 2021? | null | ['hardware_dim_customer' 'hardware_fact_pre_invoice_deductions'
'web_sales_reps' 'hardware_dim_product' 'web_orders' 'StaffHours'
'university_enrollment' 'university_faculty' 'university_student'
'university_offering' 'web_accounts' 'web_events' 'SalaryDataset'
'web_region' 'hardware_fact_gross_price'
'hardware_fact_manufacturing_cost' 'university_course'
'hardware_fact_sales_monthly' 'NAMES'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: education_business
2. **Tables**: hardware_dim_customer, hardware_fact_pre_invoice_deductions, web_sales_reps, hardware_dim_product, web_orders, StaffHours, university_enrollment, university_faculty, university_student, university_offering, web_accounts, web_events, SalaryDataset, web_region, hardware_fact_gross_price, hardware_fact_manufacturing_cost, university_course, hardware_fact_sales_monthly, NAMES
3. **User Question**: Can you provide a list of hardware product segments along with their unique product counts for 2020 in the output, ordered by the highest percentage increase in unique fact sales products from 2020 to 2021?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local059 | education_business | null | For the calendar year 2021, what is the overall average quantity sold of the top three best-selling hardware products (by total quantity sold) in each division? | null | ['hardware_dim_customer' 'hardware_fact_pre_invoice_deductions'
'web_sales_reps' 'hardware_dim_product' 'web_orders' 'StaffHours'
'university_enrollment' 'university_faculty' 'university_student'
'university_offering' 'web_accounts' 'web_events' 'SalaryDataset'
'web_region' 'hardware_fact_gross_price'
'hardware_fact_manufacturing_cost' 'university_course'
'hardware_fact_sales_monthly' 'NAMES'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: education_business
2. **Tables**: hardware_dim_customer, hardware_fact_pre_invoice_deductions, web_sales_reps, hardware_dim_product, web_orders, StaffHours, university_enrollment, university_faculty, university_student, university_offering, web_accounts, web_events, SalaryDataset, web_region, hardware_fact_gross_price, hardware_fact_manufacturing_cost, university_course, hardware_fact_sales_monthly, NAMES
3. **User Question**: For the calendar year 2021, what is the overall average quantity sold of the top three best-selling hardware products (by total quantity sold) in each division?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local060 | complex_oracle | null | In the United States, for Q4 2019 and Q4 2020, first select only those cities where total sales (with no promotions) rose by at least 20% from Q4 2019 to Q4 2020. Among these cities, rank products by their overall sales (still excluding promotions) in those quarters and take the top 20%. Then compute each top product’s share of total sales in Q4 2019 and Q4 2020 and calculate the difference in share from Q4 2019 to Q4 2020, returning the results in descending order of that share change. | null | ['countries' 'customers' 'promotions' 'products' 'times' 'channels'
'sales' 'costs' 'supplementary_demographics' 'currency'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: complex_oracle
2. **Tables**: countries, customers, promotions, products, times, channels, sales, costs, supplementary_demographics, currency
3. **User Question**: In the United States, for Q4 2019 and Q4 2020, first select only those cities where total sales (with no promotions) rose by at least 20% from Q4 2019 to Q4 2020. Among these cities, rank products by their overall sales (still excluding promotions) in those quarters and take the top 20%. Then compute each top product’s share of total sales in Q4 2019 and Q4 2020 and calculate the difference in share from Q4 2019 to Q4 2020, returning the results in descending order of that share change.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local063 | complex_oracle | null | Among all products sold in the United States with promo_id=999, considering only those cities whose sales increased by at least 20% from Q4 2019 (calendar_quarter_id=1772) to Q4 2020 (calendar_quarter_id=1776), which product that ranks in the top 20% of total sales has the smallest percentage-point change in its share of total sales between these two quarters? | null | ['countries' 'customers' 'promotions' 'products' 'times' 'channels'
'sales' 'costs' 'supplementary_demographics' 'currency'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: complex_oracle
2. **Tables**: countries, customers, promotions, products, times, channels, sales, costs, supplementary_demographics, currency
3. **User Question**: Among all products sold in the United States with promo_id=999, considering only those cities whose sales increased by at least 20% from Q4 2019 (calendar_quarter_id=1772) to Q4 2020 (calendar_quarter_id=1776), which product that ranks in the top 20% of total sales has the smallest percentage-point change in its share of total sales between these two quarters?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local061 | complex_oracle | null | What is the average projected monthly sales in USD for France in 2021, considering only product sales with promotions where promo_total_id = 1 and channels where channel_total_id = 1, by taking each product’s monthly sales from 2019 and 2020, calculating the growth rate from 2019 to 2020 for that same product and month, applying this growth rate to project 2021 monthly sales, converting all projected 2021 amounts to USD with the 2021 exchange rates, and finally averaging and listing them by month? | null | ['countries' 'customers' 'promotions' 'products' 'times' 'channels'
'sales' 'costs' 'supplementary_demographics' 'currency'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: complex_oracle
2. **Tables**: countries, customers, promotions, products, times, channels, sales, costs, supplementary_demographics, currency
3. **User Question**: What is the average projected monthly sales in USD for France in 2021, considering only product sales with promotions where promo_total_id = 1 and channels where channel_total_id = 1, by taking each product’s monthly sales from 2019 and 2020, calculating the growth rate from 2019 to 2020 for that same product and month, applying this growth rate to project 2021 monthly sales, converting all projected 2021 amounts to USD with the 2021 exchange rates, and finally averaging and listing them by month?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local050 | complex_oracle | null | What is the median of the average monthly projected sales in USD for France in 2021, calculated by using the monthly sales data from 2019 and 2020 (filtered by promo_total_id=1 and channel_total_id=1), applying the growth rate from 2019 to 2020 to project 2021, converting to USD based on the currency table, and then determining the monthly averages before finding their median? | null | ['countries' 'customers' 'promotions' 'products' 'times' 'channels'
'sales' 'costs' 'supplementary_demographics' 'currency'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: complex_oracle
2. **Tables**: countries, customers, promotions, products, times, channels, sales, costs, supplementary_demographics, currency
3. **User Question**: What is the median of the average monthly projected sales in USD for France in 2021, calculated by using the monthly sales data from 2019 and 2020 (filtered by promo_total_id=1 and channel_total_id=1), applying the growth rate from 2019 to 2020 to project 2021, converting to USD based on the currency table, and then determining the monthly averages before finding their median?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local062 | complex_oracle | null | Please group all Italian customers into ten buckets for December 2021 by summing their profits from all products purchased (where profit is calculated as quantity_sold multiplied by the difference between unit_price and unit_cost), then divide the overall range of total monthly profits into ten equal intervals. For each bucket, provide the number of customers, and identify the minimum and maximum total profits within that bucket. | null | ['countries' 'customers' 'promotions' 'products' 'times' 'channels'
'sales' 'costs' 'supplementary_demographics' 'currency'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: complex_oracle
2. **Tables**: countries, customers, promotions, products, times, channels, sales, costs, supplementary_demographics, currency
3. **User Question**: Please group all Italian customers into ten buckets for December 2021 by summing their profits from all products purchased (where profit is calculated as quantity_sold multiplied by the difference between unit_price and unit_cost), then divide the overall range of total monthly profits into ten equal intervals. For each bucket, provide the number of customers, and identify the minimum and maximum total profits within that bucket.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local067 | complex_oracle | null | Can you provide the highest and lowest profits for Italian customers segmented into ten evenly divided tiers based on their December 2021 sales profits? | null | ['countries' 'customers' 'promotions' 'products' 'times' 'channels'
'sales' 'costs' 'supplementary_demographics' 'currency'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: complex_oracle
2. **Tables**: countries, customers, promotions, products, times, channels, sales, costs, supplementary_demographics, currency
3. **User Question**: Can you provide the highest and lowest profits for Italian customers segmented into ten evenly divided tiers based on their December 2021 sales profits?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local070 | city_legislation | null | Please examine our database records for Chinese cities (country_code_2 = 'cn') during July 2021 and identify both the shortest and longest streaks of consecutive date entries. For each date in these streaks, return exactly one record per date along with the corresponding city name. In your output, please ensure the first letter of each city name is capitalized and the rest are lowercase. Display the dates and city names for both the shortest and longest consecutive date streaks, ordered by date. | null | ['aliens_details' 'skills_dim' 'legislators_terms' 'cities_currencies'
'legislators' 'skills_job_dim' 'job_postings_fact' 'alien_data'
'cities_countries' 'legislation_date_dim' 'cities' 'aliens_location'
'aliens' 'cities_languages' 'job_company' 'city_legislation'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: city_legislation
2. **Tables**: aliens_details, skills_dim, legislators_terms, cities_currencies, legislators, skills_job_dim, job_postings_fact, alien_data, cities_countries, legislation_date_dim, cities, aliens_location, aliens, cities_languages, job_company, city_legislation
3. **User Question**: Please examine our database records for Chinese cities (country_code_2 = 'cn') during July 2021 and identify both the shortest and longest streaks of consecutive date entries. For each date in these streaks, return exactly one record per date along with the corresponding city name. In your output, please ensure the first letter of each city name is capitalized and the rest are lowercase. Display the dates and city names for both the shortest and longest consecutive date streaks, ordered by date.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local071 | city_legislation | null | Could you review our records in June 2022 and identify which countries have the longest streak of consecutive inserted city dates? Please list the 2-letter length country codes of these countries. | null | ['aliens_details' 'skills_dim' 'legislators_terms' 'cities_currencies'
'legislators' 'skills_job_dim' 'job_postings_fact' 'alien_data'
'cities_countries' 'legislation_date_dim' 'cities' 'aliens_location'
'aliens' 'cities_languages' 'job_company' 'city_legislation'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: city_legislation
2. **Tables**: aliens_details, skills_dim, legislators_terms, cities_currencies, legislators, skills_job_dim, job_postings_fact, alien_data, cities_countries, legislation_date_dim, cities, aliens_location, aliens, cities_languages, job_company, city_legislation
3. **User Question**: Could you review our records in June 2022 and identify which countries have the longest streak of consecutive inserted city dates? Please list the 2-letter length country codes of these countries.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local072 | city_legislation | null | Identify the country with data inserted on nine different days in January 2022. Then, find the longest consecutive period with data insertions for this country during January 2022, and calculate the proportion of entries that are from its capital city within this longest consecutive insertion period. | null | ['aliens_details' 'skills_dim' 'legislators_terms' 'cities_currencies'
'legislators' 'skills_job_dim' 'job_postings_fact' 'alien_data'
'cities_countries' 'legislation_date_dim' 'cities' 'aliens_location'
'aliens' 'cities_languages' 'job_company' 'city_legislation'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: city_legislation
2. **Tables**: aliens_details, skills_dim, legislators_terms, cities_currencies, legislators, skills_job_dim, job_postings_fact, alien_data, cities_countries, legislation_date_dim, cities, aliens_location, aliens, cities_languages, job_company, city_legislation
3. **User Question**: Identify the country with data inserted on nine different days in January 2022. Then, find the longest consecutive period with data insertions for this country during January 2022, and calculate the proportion of entries that are from its capital city within this longest consecutive insertion period.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local068 | city_legislation | null | Calculate the number of new cities inserted in April, May, and June for each year from 2021 to 2023. For each month, compute the cumulative running total of cities added for that specific month across the years up to and including the given year (i.e., sum the counts of that month over the years). Additionally, calculate the year-over-year growth percentages for both the monthly total and the running total for each month, comparing each year to the previous year. Present the results only for 2022 and 2023, listing the year, the month, the total number of cities added in that month, the cumulative running total for that month, and the year-over-year growth percentages for both the monthly total and the running total. Use the data from 2021 solely as a baseline for calculating growth rates, and exclude it from the final output. | null | ['aliens_details' 'skills_dim' 'legislators_terms' 'cities_currencies'
'legislators' 'skills_job_dim' 'job_postings_fact' 'alien_data'
'cities_countries' 'legislation_date_dim' 'cities' 'aliens_location'
'aliens' 'cities_languages' 'job_company' 'city_legislation'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: city_legislation
2. **Tables**: aliens_details, skills_dim, legislators_terms, cities_currencies, legislators, skills_job_dim, job_postings_fact, alien_data, cities_countries, legislation_date_dim, cities, aliens_location, aliens, cities_languages, job_company, city_legislation
3. **User Question**: Calculate the number of new cities inserted in April, May, and June for each year from 2021 to 2023. For each month, compute the cumulative running total of cities added for that specific month across the years up to and including the given year (i.e., sum the counts of that month over the years). Additionally, calculate the year-over-year growth percentages for both the monthly total and the running total for each month, comparing each year to the previous year. Present the results only for 2022 and 2023, listing the year, the month, the total number of cities added in that month, the cumulative running total for that month, and the year-over-year growth percentages for both the monthly total and the running total. Use the data from 2021 solely as a baseline for calculating growth rates, and exclude it from the final output.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local073 | modern_data | null | For each pizza order, provide a single result row with the row ID, order ID, customer ID, pizza name, and final set of ingredients. The final ingredients are determined by starting with the standard toppings from the pizza’s recipe, removing any excluded toppings, and adding any extra toppings. Present the ingredients in a string starting with the pizza name followed by ': ', with ingredients listed in alphabetical order. Ingredients appearing multiple times (e.g., from standard and extra toppings) should be prefixed with '2x' and listed first, followed by single-occurrence ingredients, both in alphabetical order. Group by row ID, order ID, pizza name, and order time to ensure each order appears once. Sort results by row ID in ascending order. Assign pizza_id 1 to 'Meatlovers' pizzas and pizza_id 2 to all others. | null | ['pizza_names' 'companies_funding' 'pizza_customer_orders'
'pizza_toppings' 'trees' 'pizza_recipes' 'statistics' 'income_trees'
'pizza_clean_runner_orders' 'pizza_runner_orders' 'word_list'
'companies_dates' 'pizza_get_extras' 'pizza_get_exclusions'
'pizza_clean_customer_orders' 'companies_industries' 'pizza_runners'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: modern_data
2. **Tables**: pizza_names, companies_funding, pizza_customer_orders, pizza_toppings, trees, pizza_recipes, statistics, income_trees, pizza_clean_runner_orders, pizza_runner_orders, word_list, companies_dates, pizza_get_extras, pizza_get_exclusions, pizza_clean_customer_orders, companies_industries, pizza_runners
3. **User Question**: For each pizza order, provide a single result row with the row ID, order ID, customer ID, pizza name, and final set of ingredients. The final ingredients are determined by starting with the standard toppings from the pizza’s recipe, removing any excluded toppings, and adding any extra toppings. Present the ingredients in a string starting with the pizza name followed by ': ', with ingredients listed in alphabetical order. Ingredients appearing multiple times (e.g., from standard and extra toppings) should be prefixed with '2x' and listed first, followed by single-occurrence ingredients, both in alphabetical order. Group by row ID, order ID, pizza name, and order time to ensure each order appears once. Sort results by row ID in ascending order. Assign pizza_id 1 to 'Meatlovers' pizzas and pizza_id 2 to all others.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local066 | modern_data | WITH cte_cleaned_customer_orders AS (
SELECT
*,
ROW_NUMBER() OVER () AS original_row_number
FROM
pizza_clean_customer_orders
),
split_regular_toppings AS (
SELECT
pizza_id,
TRIM(SUBSTR(toppings, 1, INSTR(toppings || ',', ',') - 1)) AS topping_id,
SUBSTR(toppings || ',', INSTR(toppings || ',', ',') + 1) AS remaining_toppings
FROM
pizza_recipes
UNION ALL
SELECT
pizza_id,
TRIM(SUBSTR(remaining_toppings, 1, INSTR(remaining_toppings, ',') - 1)) AS topping_id,
SUBSTR(remaining_toppings, INSTR(remaining_toppings, ',') + 1) AS remaining_toppings
FROM
split_regular_toppings
WHERE
remaining_toppings <> ''
),
cte_base_toppings AS (
SELECT
t1.order_id,
t1.customer_id,
t1.pizza_id,
t1.order_time,
t1.original_row_number,
t2.topping_id
FROM
cte_cleaned_customer_orders AS t1
LEFT JOIN
split_regular_toppings AS t2
ON
t1.pizza_id = t2.pizza_id
),
split_exclusions AS (
SELECT
order_id,
customer_id,
pizza_id,
order_time,
original_row_number,
TRIM(SUBSTR(exclusions, 1, INSTR(exclusions || ',', ',') - 1)) AS topping_id,
SUBSTR(exclusions || ',', INSTR(exclusions || ',', ',') + 1) AS remaining_exclusions
FROM
cte_cleaned_customer_orders
WHERE
exclusions IS NOT NULL
UNION ALL
SELECT
order_id,
customer_id,
pizza_id,
order_time,
original_row_number,
TRIM(SUBSTR(remaining_exclusions, 1, INSTR(remaining_exclusions, ',') - 1)) AS topping_id,
SUBSTR(remaining_exclusions, INSTR(remaining_exclusions, ',') + 1) AS remaining_exclusions
FROM
split_exclusions
WHERE
remaining_exclusions <> ''
),
split_extras AS (
SELECT
order_id,
customer_id,
pizza_id,
order_time,
original_row_number,
TRIM(SUBSTR(extras, 1, INSTR(extras || ',', ',') - 1)) AS topping_id,
SUBSTR(extras || ',', INSTR(extras || ',', ',') + 1) AS remaining_extras
FROM
cte_cleaned_customer_orders
WHERE
extras IS NOT NULL
UNION ALL
SELECT
order_id,
customer_id,
pizza_id,
order_time,
original_row_number,
TRIM(SUBSTR(remaining_extras, 1, INSTR(remaining_extras, ',') - 1)) AS topping_id,
SUBSTR(remaining_extras, INSTR(remaining_extras, ',') + 1) AS remaining_extras
FROM
split_extras
WHERE
remaining_extras <> ''
),
cte_combined_orders AS (
SELECT
order_id,
customer_id,
pizza_id,
order_time,
original_row_number,
topping_id
FROM
cte_base_toppings
WHERE topping_id NOT IN (SELECT topping_id FROM split_exclusions WHERE split_exclusions.order_id = cte_base_toppings.order_id)
UNION ALL
SELECT
order_id,
customer_id,
pizza_id,
order_time,
original_row_number,
topping_id
FROM
split_extras
)
SELECT
t2.topping_name,
COUNT(*) AS topping_count
FROM
cte_combined_orders AS t1
JOIN
pizza_toppings AS t2
ON
t1.topping_id = t2.topping_id
GROUP BY
t2.topping_name
ORDER BY
topping_count DESC; | Based on our customer pizza order information, summarize the total quantity of each ingredient used in the pizzas we delivered. Output the name and quantity for each ingredient. | null | ['pizza_names' 'companies_funding' 'pizza_customer_orders'
'pizza_toppings' 'trees' 'pizza_recipes' 'statistics' 'income_trees'
'pizza_clean_runner_orders' 'pizza_runner_orders' 'word_list'
'companies_dates' 'pizza_get_extras' 'pizza_get_exclusions'
'pizza_clean_customer_orders' 'companies_industries' 'pizza_runners'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: modern_data
2. **Tables**: pizza_names, companies_funding, pizza_customer_orders, pizza_toppings, trees, pizza_recipes, statistics, income_trees, pizza_clean_runner_orders, pizza_runner_orders, word_list, companies_dates, pizza_get_extras, pizza_get_exclusions, pizza_clean_customer_orders, companies_industries, pizza_runners
3. **User Question**: Based on our customer pizza order information, summarize the total quantity of each ingredient used in the pizzas we delivered. Output the name and quantity for each ingredient.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local065 | modern_data | WITH get_extras_count AS (
WITH RECURSIVE split_extras AS (
SELECT
order_id,
TRIM(SUBSTR(extras, 1, INSTR(extras || ',', ',') - 1)) AS each_extra,
SUBSTR(extras || ',', INSTR(extras || ',', ',') + 1) AS remaining_extras
FROM
pizza_clean_customer_orders
UNION ALL
SELECT
order_id,
TRIM(SUBSTR(remaining_extras, 1, INSTR(remaining_extras, ',') - 1)) AS each_extra,
SUBSTR(remaining_extras, INSTR(remaining_extras, ',') + 1)
FROM
split_extras
WHERE
remaining_extras <> ''
)
SELECT
order_id,
COUNT(each_extra) AS total_extras
FROM
split_extras
GROUP BY
order_id
),
calculate_totals AS (
SELECT
t1.order_id,
t1.pizza_id,
SUM(
CASE
WHEN pizza_id = 1 THEN 12
WHEN pizza_id = 2 THEN 10
END
) AS total_price,
t3.total_extras
FROM
pizza_clean_customer_orders AS t1
JOIN
pizza_clean_runner_orders AS t2
ON
t2.order_id = t1.order_id
LEFT JOIN
get_extras_count AS t3
ON
t3.order_id = t1.order_id
WHERE
t2.cancellation IS NULL
GROUP BY
t1.order_id,
t1.pizza_id,
t3.total_extras
)
SELECT
SUM(total_price) + SUM(total_extras) AS total_income
FROM
calculate_totals; | Calculate the total income from Meat Lovers pizzas priced at $12 and Vegetarian pizzas at $10. Include any extra toppings charged at $1 each. Ensure that canceled orders are filtered out. How much money has Pizza Runner earned in total? | null | ['pizza_names' 'companies_funding' 'pizza_customer_orders'
'pizza_toppings' 'trees' 'pizza_recipes' 'statistics' 'income_trees'
'pizza_clean_runner_orders' 'pizza_runner_orders' 'word_list'
'companies_dates' 'pizza_get_extras' 'pizza_get_exclusions'
'pizza_clean_customer_orders' 'companies_industries' 'pizza_runners'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: modern_data
2. **Tables**: pizza_names, companies_funding, pizza_customer_orders, pizza_toppings, trees, pizza_recipes, statistics, income_trees, pizza_clean_runner_orders, pizza_runner_orders, word_list, companies_dates, pizza_get_extras, pizza_get_exclusions, pizza_clean_customer_orders, companies_industries, pizza_runners
3. **User Question**: Calculate the total income from Meat Lovers pizzas priced at $12 and Vegetarian pizzas at $10. Include any extra toppings charged at $1 each. Ensure that canceled orders are filtered out. How much money has Pizza Runner earned in total?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local074 | bank_sales_trading | null | Please generate a summary of the closing balances at the end of each month for each customer transactions, show the monthly changes and monthly cumulative bank account balances. Ensure that even if a customer has no account activity in a given month, the balance for that month is still included in the output. | null | ['weekly_sales' 'shopping_cart_users' 'bitcoin_members' 'interest_metrics'
'customer_regions' 'customer_transactions' 'bitcoin_transactions'
'customer_nodes' 'cleaned_weekly_sales' 'veg_txn_df'
'shopping_cart_events' 'shopping_cart_page_hierarchy' 'bitcoin_prices'
'interest_map' 'veg_loss_rate_df' 'shopping_cart_campaign_identifier'
'veg_cat' 'veg_whsle_df' 'shopping_cart_event_identifier'
'daily_transactions' 'MonthlyMaxBalances' 'monthly_balances' 'attributes'
'sqlite_sequence' 'monthly_net' 'veg_wholesale_data' 'closing_balances'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: bank_sales_trading
2. **Tables**: weekly_sales, shopping_cart_users, bitcoin_members, interest_metrics, customer_regions, customer_transactions, bitcoin_transactions, customer_nodes, cleaned_weekly_sales, veg_txn_df, shopping_cart_events, shopping_cart_page_hierarchy, bitcoin_prices, interest_map, veg_loss_rate_df, shopping_cart_campaign_identifier, veg_cat, veg_whsle_df, shopping_cart_event_identifier, daily_transactions, MonthlyMaxBalances, monthly_balances, attributes, sqlite_sequence, monthly_net, veg_wholesale_data, closing_balances
3. **User Question**: Please generate a summary of the closing balances at the end of each month for each customer transactions, show the monthly changes and monthly cumulative bank account balances. Ensure that even if a customer has no account activity in a given month, the balance for that month is still included in the output.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local064 | bank_sales_trading | null | For each customer and each month of 2020, first calculate the month-end balance by adding all deposit amounts and subtracting all withdrawal amounts that occurred during that specific month. Then determine which month in 2020 has the highest count of customers with a positive month-end balance and which month has the lowest count. For each of these two months, compute the average month-end balance across all customers and provide the difference between these two averages | null | ['weekly_sales' 'shopping_cart_users' 'bitcoin_members' 'interest_metrics'
'customer_regions' 'customer_transactions' 'bitcoin_transactions'
'customer_nodes' 'cleaned_weekly_sales' 'veg_txn_df'
'shopping_cart_events' 'shopping_cart_page_hierarchy' 'bitcoin_prices'
'interest_map' 'veg_loss_rate_df' 'shopping_cart_campaign_identifier'
'veg_cat' 'veg_whsle_df' 'shopping_cart_event_identifier'
'daily_transactions' 'MonthlyMaxBalances' 'monthly_balances' 'attributes'
'sqlite_sequence' 'monthly_net' 'veg_wholesale_data' 'closing_balances'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: bank_sales_trading
2. **Tables**: weekly_sales, shopping_cart_users, bitcoin_members, interest_metrics, customer_regions, customer_transactions, bitcoin_transactions, customer_nodes, cleaned_weekly_sales, veg_txn_df, shopping_cart_events, shopping_cart_page_hierarchy, bitcoin_prices, interest_map, veg_loss_rate_df, shopping_cart_campaign_identifier, veg_cat, veg_whsle_df, shopping_cart_event_identifier, daily_transactions, MonthlyMaxBalances, monthly_balances, attributes, sqlite_sequence, monthly_net, veg_wholesale_data, closing_balances
3. **User Question**: For each customer and each month of 2020, first calculate the month-end balance by adding all deposit amounts and subtracting all withdrawal amounts that occurred during that specific month. Then determine which month in 2020 has the highest count of customers with a positive month-end balance and which month has the lowest count. For each of these two months, compute the average month-end balance across all customers and provide the difference between these two averages
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local297 | bank_sales_trading | null | For each customer, group all deposits and withdrawals by the first day of each month to obtain a monthly net amount, then calculate each month’s closing balance by cumulatively summing these monthly nets. Next, determine the most recent month’s growth rate by comparing its closing balance to the prior month’s balance, treating deposits as positive and withdrawals as negative, and if the previous month’s balance is zero, the growth rate should be the current month’s balance multiplied by 100. Finally, compute the percentage of customers whose most recent month shows a growth rate of more than 5%. | null | ['weekly_sales' 'shopping_cart_users' 'bitcoin_members' 'interest_metrics'
'customer_regions' 'customer_transactions' 'bitcoin_transactions'
'customer_nodes' 'cleaned_weekly_sales' 'veg_txn_df'
'shopping_cart_events' 'shopping_cart_page_hierarchy' 'bitcoin_prices'
'interest_map' 'veg_loss_rate_df' 'shopping_cart_campaign_identifier'
'veg_cat' 'veg_whsle_df' 'shopping_cart_event_identifier'
'daily_transactions' 'MonthlyMaxBalances' 'monthly_balances' 'attributes'
'sqlite_sequence' 'monthly_net' 'veg_wholesale_data' 'closing_balances'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: bank_sales_trading
2. **Tables**: weekly_sales, shopping_cart_users, bitcoin_members, interest_metrics, customer_regions, customer_transactions, bitcoin_transactions, customer_nodes, cleaned_weekly_sales, veg_txn_df, shopping_cart_events, shopping_cart_page_hierarchy, bitcoin_prices, interest_map, veg_loss_rate_df, shopping_cart_campaign_identifier, veg_cat, veg_whsle_df, shopping_cart_event_identifier, daily_transactions, MonthlyMaxBalances, monthly_balances, attributes, sqlite_sequence, monthly_net, veg_wholesale_data, closing_balances
3. **User Question**: For each customer, group all deposits and withdrawals by the first day of each month to obtain a monthly net amount, then calculate each month’s closing balance by cumulatively summing these monthly nets. Next, determine the most recent month’s growth rate by comparing its closing balance to the prior month’s balance, treating deposits as positive and withdrawals as negative, and if the previous month’s balance is zero, the growth rate should be the current month’s balance multiplied by 100. Finally, compute the percentage of customers whose most recent month shows a growth rate of more than 5%.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local298 | bank_sales_trading | null | For each month, calculate the total balance from all users for the previous month (measured as of the 1st of each month), replacing any negative balances with zero. Ensure that data from the first month is used only as a baseline for calculating previous total balance, and exclude it from the final output. Sort the results in ascending order by month. | null | ['weekly_sales' 'shopping_cart_users' 'bitcoin_members' 'interest_metrics'
'customer_regions' 'customer_transactions' 'bitcoin_transactions'
'customer_nodes' 'cleaned_weekly_sales' 'veg_txn_df'
'shopping_cart_events' 'shopping_cart_page_hierarchy' 'bitcoin_prices'
'interest_map' 'veg_loss_rate_df' 'shopping_cart_campaign_identifier'
'veg_cat' 'veg_whsle_df' 'shopping_cart_event_identifier'
'daily_transactions' 'MonthlyMaxBalances' 'monthly_balances' 'attributes'
'sqlite_sequence' 'monthly_net' 'veg_wholesale_data' 'closing_balances'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: bank_sales_trading
2. **Tables**: weekly_sales, shopping_cart_users, bitcoin_members, interest_metrics, customer_regions, customer_transactions, bitcoin_transactions, customer_nodes, cleaned_weekly_sales, veg_txn_df, shopping_cart_events, shopping_cart_page_hierarchy, bitcoin_prices, interest_map, veg_loss_rate_df, shopping_cart_campaign_identifier, veg_cat, veg_whsle_df, shopping_cart_event_identifier, daily_transactions, MonthlyMaxBalances, monthly_balances, attributes, sqlite_sequence, monthly_net, veg_wholesale_data, closing_balances
3. **User Question**: For each month, calculate the total balance from all users for the previous month (measured as of the 1st of each month), replacing any negative balances with zero. Ensure that data from the first month is used only as a baseline for calculating previous total balance, and exclude it from the final output. Sort the results in ascending order by month.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local299 | bank_sales_trading | null | For a bank database with customer transactions, calculate each customer's daily running balance (where deposits add to the balance and other transaction types subtract). For each customer and each day, compute the 30-day rolling average balance (only after having 30 days of data, and treating negative averages as zero). Then group these daily averages by month and find each customer's maximum 30-day average balance within each month. Sum these maximum values across all customers for each month. Consider the first month of each customer's transaction history as the baseline period and exclude it from the final results, presenting monthly totals of these summed maximum 30-day average balances. | null | ['weekly_sales' 'shopping_cart_users' 'bitcoin_members' 'interest_metrics'
'customer_regions' 'customer_transactions' 'bitcoin_transactions'
'customer_nodes' 'cleaned_weekly_sales' 'veg_txn_df'
'shopping_cart_events' 'shopping_cart_page_hierarchy' 'bitcoin_prices'
'interest_map' 'veg_loss_rate_df' 'shopping_cart_campaign_identifier'
'veg_cat' 'veg_whsle_df' 'shopping_cart_event_identifier'
'daily_transactions' 'MonthlyMaxBalances' 'monthly_balances' 'attributes'
'sqlite_sequence' 'monthly_net' 'veg_wholesale_data' 'closing_balances'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: bank_sales_trading
2. **Tables**: weekly_sales, shopping_cart_users, bitcoin_members, interest_metrics, customer_regions, customer_transactions, bitcoin_transactions, customer_nodes, cleaned_weekly_sales, veg_txn_df, shopping_cart_events, shopping_cart_page_hierarchy, bitcoin_prices, interest_map, veg_loss_rate_df, shopping_cart_campaign_identifier, veg_cat, veg_whsle_df, shopping_cart_event_identifier, daily_transactions, MonthlyMaxBalances, monthly_balances, attributes, sqlite_sequence, monthly_net, veg_wholesale_data, closing_balances
3. **User Question**: For a bank database with customer transactions, calculate each customer's daily running balance (where deposits add to the balance and other transaction types subtract). For each customer and each day, compute the 30-day rolling average balance (only after having 30 days of data, and treating negative averages as zero). Then group these daily averages by month and find each customer's maximum 30-day average balance within each month. Sum these maximum values across all customers for each month. Consider the first month of each customer's transaction history as the baseline period and exclude it from the final results, presenting monthly totals of these summed maximum 30-day average balances.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local300 | bank_sales_trading | null | For each customer, calculate their daily balances for every day between their earliest and latest transaction dates, including days without transactions by carrying forward the previous day's balance. Treat any negative daily balances as zero. Then, for each month, determine the highest daily balance each customer had during that month. Finally, for each month, sum these maximum daily balances across all customers to obtain a monthly total. | null | ['weekly_sales' 'shopping_cart_users' 'bitcoin_members' 'interest_metrics'
'customer_regions' 'customer_transactions' 'bitcoin_transactions'
'customer_nodes' 'cleaned_weekly_sales' 'veg_txn_df'
'shopping_cart_events' 'shopping_cart_page_hierarchy' 'bitcoin_prices'
'interest_map' 'veg_loss_rate_df' 'shopping_cart_campaign_identifier'
'veg_cat' 'veg_whsle_df' 'shopping_cart_event_identifier'
'daily_transactions' 'MonthlyMaxBalances' 'monthly_balances' 'attributes'
'sqlite_sequence' 'monthly_net' 'veg_wholesale_data' 'closing_balances'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: bank_sales_trading
2. **Tables**: weekly_sales, shopping_cart_users, bitcoin_members, interest_metrics, customer_regions, customer_transactions, bitcoin_transactions, customer_nodes, cleaned_weekly_sales, veg_txn_df, shopping_cart_events, shopping_cart_page_hierarchy, bitcoin_prices, interest_map, veg_loss_rate_df, shopping_cart_campaign_identifier, veg_cat, veg_whsle_df, shopping_cart_event_identifier, daily_transactions, MonthlyMaxBalances, monthly_balances, attributes, sqlite_sequence, monthly_net, veg_wholesale_data, closing_balances
3. **User Question**: For each customer, calculate their daily balances for every day between their earliest and latest transaction dates, including days without transactions by carrying forward the previous day's balance. Treat any negative daily balances as zero. Then, for each month, determine the highest daily balance each customer had during that month. Finally, for each month, sum these maximum daily balances across all customers to obtain a monthly total.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local075 | bank_sales_trading | WITH product_viewed AS (
SELECT
t1.page_id,
SUM(CASE WHEN event_type = 1 THEN 1 ELSE 0 END) AS n_page_views,
SUM(CASE WHEN event_type = 2 THEN 1 ELSE 0 END) AS n_added_to_cart
FROM
shopping_cart_page_hierarchy AS t1
JOIN
shopping_cart_events AS t2
ON
t1.page_id = t2.page_id
WHERE
t1.product_id IS NOT NULL
GROUP BY
t1.page_id
),
product_purchased AS (
SELECT
t2.page_id,
SUM(CASE WHEN event_type = 2 THEN 1 ELSE 0 END) AS purchased_from_cart
FROM
shopping_cart_page_hierarchy AS t1
JOIN
shopping_cart_events AS t2
ON
t1.page_id = t2.page_id
WHERE
t1.product_id IS NOT NULL
AND EXISTS (
SELECT
visit_id
FROM
shopping_cart_events
WHERE
event_type = 3
AND t2.visit_id = visit_id
)
AND t1.page_id NOT IN (1, 2, 12, 13)
GROUP BY
t2.page_id
),
product_abandoned AS (
SELECT
t2.page_id,
SUM(CASE WHEN event_type = 2 THEN 1 ELSE 0 END) AS abandoned_in_cart
FROM
shopping_cart_page_hierarchy AS t1
JOIN
shopping_cart_events AS t2
ON
t1.page_id = t2.page_id
WHERE
t1.product_id IS NOT NULL
AND NOT EXISTS (
SELECT
visit_id
FROM
shopping_cart_events
WHERE
event_type = 3
AND t2.visit_id = visit_id
)
AND t1.page_id NOT IN (1, 2, 12, 13)
GROUP BY
t2.page_id
)
SELECT
t1.page_id,
t1.page_name,
t2.n_page_views AS 'number of product being viewed',
t2.n_added_to_cart AS 'number added to the cart',
t4.abandoned_in_cart AS 'without being purchased in cart',
t3.purchased_from_cart AS 'count of actual purchases'
FROM
shopping_cart_page_hierarchy AS t1
JOIN
product_viewed AS t2
ON
t2.page_id = t1.page_id
JOIN
product_purchased AS t3
ON
t3.page_id = t1.page_id
JOIN
product_abandoned AS t4
ON
t4.page_id = t1.page_id; | Can you provide a breakdown of how many times each product was viewed, how many times they were added to the shopping cart, and how many times they were left in the cart without being purchased? Also, give me the count of actual purchases for each product. Ensure that products with a page id in (1, 2, 12, 13) are filtered out. | null | ['weekly_sales' 'shopping_cart_users' 'bitcoin_members' 'interest_metrics'
'customer_regions' 'customer_transactions' 'bitcoin_transactions'
'customer_nodes' 'cleaned_weekly_sales' 'veg_txn_df'
'shopping_cart_events' 'shopping_cart_page_hierarchy' 'bitcoin_prices'
'interest_map' 'veg_loss_rate_df' 'shopping_cart_campaign_identifier'
'veg_cat' 'veg_whsle_df' 'shopping_cart_event_identifier'
'daily_transactions' 'MonthlyMaxBalances' 'monthly_balances' 'attributes'
'sqlite_sequence' 'monthly_net' 'veg_wholesale_data' 'closing_balances'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: bank_sales_trading
2. **Tables**: weekly_sales, shopping_cart_users, bitcoin_members, interest_metrics, customer_regions, customer_transactions, bitcoin_transactions, customer_nodes, cleaned_weekly_sales, veg_txn_df, shopping_cart_events, shopping_cart_page_hierarchy, bitcoin_prices, interest_map, veg_loss_rate_df, shopping_cart_campaign_identifier, veg_cat, veg_whsle_df, shopping_cart_event_identifier, daily_transactions, MonthlyMaxBalances, monthly_balances, attributes, sqlite_sequence, monthly_net, veg_wholesale_data, closing_balances
3. **User Question**: Can you provide a breakdown of how many times each product was viewed, how many times they were added to the shopping cart, and how many times they were left in the cart without being purchased? Also, give me the count of actual purchases for each product. Ensure that products with a page id in (1, 2, 12, 13) are filtered out.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local077 | bank_sales_trading | null | Please analyze our interest data from September 2018 to August 2019. For each month, calculate the average composition for each interest by dividing the composition by the index value. Identify the interest with the highest average composition value each month and report its average composition as the max index composition for that month. Compute the three-month rolling average of these monthly max index compositions. Ensure the output includes the date, the interest name, the max index composition for that month, the rolling average, and the names and max index compositions of the top interests from one month ago and two months ago. | null | ['weekly_sales' 'shopping_cart_users' 'bitcoin_members' 'interest_metrics'
'customer_regions' 'customer_transactions' 'bitcoin_transactions'
'customer_nodes' 'cleaned_weekly_sales' 'veg_txn_df'
'shopping_cart_events' 'shopping_cart_page_hierarchy' 'bitcoin_prices'
'interest_map' 'veg_loss_rate_df' 'shopping_cart_campaign_identifier'
'veg_cat' 'veg_whsle_df' 'shopping_cart_event_identifier'
'daily_transactions' 'MonthlyMaxBalances' 'monthly_balances' 'attributes'
'sqlite_sequence' 'monthly_net' 'veg_wholesale_data' 'closing_balances'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: bank_sales_trading
2. **Tables**: weekly_sales, shopping_cart_users, bitcoin_members, interest_metrics, customer_regions, customer_transactions, bitcoin_transactions, customer_nodes, cleaned_weekly_sales, veg_txn_df, shopping_cart_events, shopping_cart_page_hierarchy, bitcoin_prices, interest_map, veg_loss_rate_df, shopping_cart_campaign_identifier, veg_cat, veg_whsle_df, shopping_cart_event_identifier, daily_transactions, MonthlyMaxBalances, monthly_balances, attributes, sqlite_sequence, monthly_net, veg_wholesale_data, closing_balances
3. **User Question**: Please analyze our interest data from September 2018 to August 2019. For each month, calculate the average composition for each interest by dividing the composition by the index value. Identify the interest with the highest average composition value each month and report its average composition as the max index composition for that month. Compute the three-month rolling average of these monthly max index compositions. Ensure the output includes the date, the interest name, the max index composition for that month, the rolling average, and the names and max index compositions of the top interests from one month ago and two months ago.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local078 | bank_sales_trading | WITH get_interest_rank AS (
SELECT
t1.month_year,
t2.interest_name,
t1.composition,
RANK() OVER (
PARTITION BY t2.interest_name
ORDER BY t1.composition DESC
) AS interest_rank
FROM
interest_metrics AS t1
JOIN
interest_map AS t2
ON
t1.interest_id = t2.id
WHERE
t1.month_year IS NOT NULL
),
get_top_10 AS (
SELECT
month_year,
interest_name,
composition
FROM
get_interest_rank
WHERE
interest_rank = 1
ORDER BY
composition DESC
LIMIT 10
),
get_bottom_10 AS (
SELECT
month_year,
interest_name,
composition
FROM
get_interest_rank
WHERE
interest_rank = 1
ORDER BY
composition ASC
LIMIT 10
)
SELECT *
FROM
get_top_10
UNION
SELECT *
FROM
get_bottom_10
ORDER BY
composition DESC; | Identify the top 10 and bottom 10 interest categories based on their highest composition values across all months. For each category, display the time(MM-YYYY), interest name, and the composition value | null | ['weekly_sales' 'shopping_cart_users' 'bitcoin_members' 'interest_metrics'
'customer_regions' 'customer_transactions' 'bitcoin_transactions'
'customer_nodes' 'cleaned_weekly_sales' 'veg_txn_df'
'shopping_cart_events' 'shopping_cart_page_hierarchy' 'bitcoin_prices'
'interest_map' 'veg_loss_rate_df' 'shopping_cart_campaign_identifier'
'veg_cat' 'veg_whsle_df' 'shopping_cart_event_identifier'
'daily_transactions' 'MonthlyMaxBalances' 'monthly_balances' 'attributes'
'sqlite_sequence' 'monthly_net' 'veg_wholesale_data' 'closing_balances'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: bank_sales_trading
2. **Tables**: weekly_sales, shopping_cart_users, bitcoin_members, interest_metrics, customer_regions, customer_transactions, bitcoin_transactions, customer_nodes, cleaned_weekly_sales, veg_txn_df, shopping_cart_events, shopping_cart_page_hierarchy, bitcoin_prices, interest_map, veg_loss_rate_df, shopping_cart_campaign_identifier, veg_cat, veg_whsle_df, shopping_cart_event_identifier, daily_transactions, MonthlyMaxBalances, monthly_balances, attributes, sqlite_sequence, monthly_net, veg_wholesale_data, closing_balances
3. **User Question**: Identify the top 10 and bottom 10 interest categories based on their highest composition values across all months. For each category, display the time(MM-YYYY), interest name, and the composition value
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local081 | northwind | null | Considering only the customers who placed orders in 1998, calculate the total amount each customer spent by summing the unit price multiplied by the quantity of all products in their orders, excluding any discounts. Assign each customer to a spending group based on the customer group thresholds, and determine how many customers are in each spending group and what percentage of the total number of customers who placed orders in 1998 each group represents. | null | ['categories' 'customercustomerdemo' 'customerdemographics' 'customers'
'employees' 'employeeterritories' 'order_details' 'orders' 'products'
'region' 'shippers' 'suppliers' 'territories' 'usstates'
'customergroupthreshold'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: northwind
2. **Tables**: categories, customercustomerdemo, customerdemographics, customers, employees, employeeterritories, order_details, orders, products, region, shippers, suppliers, territories, usstates, customergroupthreshold
3. **User Question**: Considering only the customers who placed orders in 1998, calculate the total amount each customer spent by summing the unit price multiplied by the quantity of all products in their orders, excluding any discounts. Assign each customer to a spending group based on the customer group thresholds, and determine how many customers are in each spending group and what percentage of the total number of customers who placed orders in 1998 each group represents.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local085 | northwind | null | Among employees who have more than 50 total orders, which three have the highest percentage of late orders, where an order is considered late if the shipped date is on or after its required date? Please list each employee's ID, the number of late orders, and the corresponding late-order percentage. | null | ['categories' 'customercustomerdemo' 'customerdemographics' 'customers'
'employees' 'employeeterritories' 'order_details' 'orders' 'products'
'region' 'shippers' 'suppliers' 'territories' 'usstates'
'customergroupthreshold'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: northwind
2. **Tables**: categories, customercustomerdemo, customerdemographics, customers, employees, employeeterritories, order_details, orders, products, region, shippers, suppliers, territories, usstates, customergroupthreshold
3. **User Question**: Among employees who have more than 50 total orders, which three have the highest percentage of late orders, where an order is considered late if the shipped date is on or after its required date? Please list each employee's ID, the number of late orders, and the corresponding late-order percentage.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local096 | Db-IMDB | null | For each year, calculate the percentage of films that had exclusively female actors (meaning no male actors and no actors with unknown/unspecified gender). Consider actors with gender marked as 'Male' or 'None' as non-female. For the results, display the year, the total number of movies in that year, and the percentage of movies with exclusively female actors. Extract the year from the Movie.year field by taking the last 4 characters and converting to a number. | null | ['Movie' 'Genre' 'Language' 'Country' 'Location' 'M_Location' 'M_Country'
'M_Language' 'M_Genre' 'Person' 'M_Producer' 'M_Director' 'M_Cast'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Db-IMDB
2. **Tables**: Movie, Genre, Language, Country, Location, M_Location, M_Country, M_Language, M_Genre, Person, M_Producer, M_Director, M_Cast
3. **User Question**: For each year, calculate the percentage of films that had exclusively female actors (meaning no male actors and no actors with unknown/unspecified gender). Consider actors with gender marked as 'Male' or 'None' as non-female. For the results, display the year, the total number of movies in that year, and the percentage of movies with exclusively female actors. Extract the year from the Movie.year field by taking the last 4 characters and converting to a number.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local097 | Db-IMDB | null | Could you analyze our data and identify which ten-year period starting from any movie release year present in the data had the largest number of films, considering consecutive ten-year periods beginning at each unique year? Only output the start year and the total count for that specific period. | null | ['Movie' 'Genre' 'Language' 'Country' 'Location' 'M_Location' 'M_Country'
'M_Language' 'M_Genre' 'Person' 'M_Producer' 'M_Director' 'M_Cast'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Db-IMDB
2. **Tables**: Movie, Genre, Language, Country, Location, M_Location, M_Country, M_Language, M_Genre, Person, M_Producer, M_Director, M_Cast
3. **User Question**: Could you analyze our data and identify which ten-year period starting from any movie release year present in the data had the largest number of films, considering consecutive ten-year periods beginning at each unique year? Only output the start year and the total count for that specific period.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local098 | Db-IMDB | null | From the first year each actor appeared in a film to the last, how many actors in the database never had a gap longer than three consecutive years without at least one new movie appearance, meaning there is no four-year span anywhere in their active career without at least a single film credit? | null | ['Movie' 'Genre' 'Language' 'Country' 'Location' 'M_Location' 'M_Country'
'M_Language' 'M_Genre' 'Person' 'M_Producer' 'M_Director' 'M_Cast'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Db-IMDB
2. **Tables**: Movie, Genre, Language, Country, Location, M_Location, M_Country, M_Language, M_Genre, Person, M_Producer, M_Director, M_Cast
3. **User Question**: From the first year each actor appeared in a film to the last, how many actors in the database never had a gap longer than three consecutive years without at least one new movie appearance, meaning there is no four-year span anywhere in their active career without at least a single film credit?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local099 | Db-IMDB | WITH YASH_CHOPRAS_PID AS (
SELECT
TRIM(P.PID) AS PID
FROM
Person P
WHERE
TRIM(P.Name) = 'Yash Chopra'
),
NUM_OF_MOV_BY_ACTOR_DIRECTOR AS (
SELECT
TRIM(MC.PID) AS ACTOR_PID,
TRIM(MD.PID) AS DIRECTOR_PID,
COUNT(DISTINCT TRIM(MD.MID)) AS NUM_OF_MOV
FROM
M_Cast MC
JOIN
M_Director MD ON TRIM(MC.MID) = TRIM(MD.MID)
GROUP BY
ACTOR_PID,
DIRECTOR_PID
),
NUM_OF_MOVIES_BY_YC AS (
SELECT
NM.ACTOR_PID,
NM.DIRECTOR_PID,
NM.NUM_OF_MOV AS NUM_OF_MOV_BY_YC
FROM
NUM_OF_MOV_BY_ACTOR_DIRECTOR NM
JOIN
YASH_CHOPRAS_PID YCP ON NM.DIRECTOR_PID = YCP.PID
),
MAX_MOV_BY_OTHER_DIRECTORS AS (
SELECT
ACTOR_PID,
MAX(NUM_OF_MOV) AS MAX_NUM_OF_MOV
FROM
NUM_OF_MOV_BY_ACTOR_DIRECTOR NM
JOIN
YASH_CHOPRAS_PID YCP ON NM.DIRECTOR_PID <> YCP.PID
GROUP BY
ACTOR_PID
),
ACTORS_MOV_COMPARISION AS (
SELECT
NMY.ACTOR_PID,
CASE WHEN NMY.NUM_OF_MOV_BY_YC > IFNULL(NMO.MAX_NUM_OF_MOV, 0) THEN 'Y' ELSE 'N' END AS MORE_MOV_BY_YC
FROM
NUM_OF_MOVIES_BY_YC NMY
LEFT OUTER JOIN
MAX_MOV_BY_OTHER_DIRECTORS NMO ON NMY.ACTOR_PID = NMO.ACTOR_PID
)
SELECT
COUNT(DISTINCT TRIM(P.PID)) AS "Number of actor"
FROM
Person P
WHERE
TRIM(P.PID) IN (
SELECT
DISTINCT ACTOR_PID
FROM
ACTORS_MOV_COMPARISION
WHERE
MORE_MOV_BY_YC = 'Y'
); | I need you to look into the actor collaborations and tell me how many actors have made more films with Yash Chopra than with any other director. This will help us understand his influence on the industry better. | null | ['Movie' 'Genre' 'Language' 'Country' 'Location' 'M_Location' 'M_Country'
'M_Language' 'M_Genre' 'Person' 'M_Producer' 'M_Director' 'M_Cast'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Db-IMDB
2. **Tables**: Movie, Genre, Language, Country, Location, M_Location, M_Country, M_Language, M_Genre, Person, M_Producer, M_Director, M_Cast
3. **User Question**: I need you to look into the actor collaborations and tell me how many actors have made more films with Yash Chopra than with any other director. This will help us understand his influence on the industry better.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local100 | Db-IMDB | null | Find out how many actors have a 'Shahrukh number' of 2? This means they acted in a film with someone who acted with Shahrukh Khan, but not directly with him. | null | ['Movie' 'Genre' 'Language' 'Country' 'Location' 'M_Location' 'M_Country'
'M_Language' 'M_Genre' 'Person' 'M_Producer' 'M_Director' 'M_Cast'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: Db-IMDB
2. **Tables**: Movie, Genre, Language, Country, Location, M_Location, M_Country, M_Language, M_Genre, Person, M_Producer, M_Director, M_Cast
3. **User Question**: Find out how many actors have a 'Shahrukh number' of 2? This means they acted in a film with someone who acted with Shahrukh Khan, but not directly with him.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local114 | education_business | null | Provide a detailed web sales report for each region, including the number of orders, total sales amount, and the name and sales amount of all sales representatives who achieved the highest total sales amount in that region (include all representatives in case of a tie). | null | ['hardware_dim_customer' 'hardware_fact_pre_invoice_deductions'
'web_sales_reps' 'hardware_dim_product' 'web_orders' 'StaffHours'
'university_enrollment' 'university_faculty' 'university_student'
'university_offering' 'web_accounts' 'web_events' 'SalaryDataset'
'web_region' 'hardware_fact_gross_price'
'hardware_fact_manufacturing_cost' 'university_course'
'hardware_fact_sales_monthly' 'NAMES'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: education_business
2. **Tables**: hardware_dim_customer, hardware_fact_pre_invoice_deductions, web_sales_reps, hardware_dim_product, web_orders, StaffHours, university_enrollment, university_faculty, university_student, university_offering, web_accounts, web_events, SalaryDataset, web_region, hardware_fact_gross_price, hardware_fact_manufacturing_cost, university_course, hardware_fact_sales_monthly, NAMES
3. **User Question**: Provide a detailed web sales report for each region, including the number of orders, total sales amount, and the name and sales amount of all sales representatives who achieved the highest total sales amount in that region (include all representatives in case of a tie).
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local128 | BowlingLeague | null | List the bowlers (including their ID, first name, and last name), match number, game number, handicap score, tournament date, and location for only those bowlers who have won games with a handicap score of 190 or less at all three venues: Thunderbird Lanes, Totem Lanes, and Bolero Lanes. Only include the specific game records where they won with a handicap score of 190 or less at these three locations. | null | ['Bowler_Scores' 'Bowler_Scores_Archive' 'Bowlers' 'sqlite_sequence'
'Match_Games' 'Match_Games_Archive' 'Teams' 'Tournaments'
'Tournaments_Archive' 'Tourney_Matches' 'Tourney_Matches_Archive'
'WAZips'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: BowlingLeague
2. **Tables**: Bowler_Scores, Bowler_Scores_Archive, Bowlers, sqlite_sequence, Match_Games, Match_Games_Archive, Teams, Tournaments, Tournaments_Archive, Tourney_Matches, Tourney_Matches_Archive, WAZips
3. **User Question**: List the bowlers (including their ID, first name, and last name), match number, game number, handicap score, tournament date, and location for only those bowlers who have won games with a handicap score of 190 or less at all three venues: Thunderbird Lanes, Totem Lanes, and Bolero Lanes. Only include the specific game records where they won with a handicap score of 190 or less at these three locations.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local130 | school_scheduling | null | Could you provide a list of last names for all students who have completed English courses (where completion is defined as having a ClassStatus of 2), along with their quintile ranks based on their individual grades in those courses? The quintile should be determined by calculating how many students have grades greater than or equal to each student's grade, then dividing this ranking by the total number of students who completed English courses. The quintiles should be labeled as "First" (top 20%), "Second" (top 21-40%), "Third" (top 41-60%), "Fourth" (top 61-80%), and "Fifth" (bottom 20%). Please sort the results from highest performing quintile to lowest (First to Fifth). | null | ['Buildings' 'Categories' 'Class_Rooms' 'sqlite_sequence' 'Classes'
'Departments' 'Faculty' 'Faculty_Categories' 'Faculty_Classes'
'Faculty_Subjects' 'Majors' 'Staff' 'Student_Class_Status'
'Student_Schedules' 'Students' 'Subjects'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: school_scheduling
2. **Tables**: Buildings, Categories, Class_Rooms, sqlite_sequence, Classes, Departments, Faculty, Faculty_Categories, Faculty_Classes, Faculty_Subjects, Majors, Staff, Student_Class_Status, Student_Schedules, Students, Subjects
3. **User Question**: Could you provide a list of last names for all students who have completed English courses (where completion is defined as having a ClassStatus of 2), along with their quintile ranks based on their individual grades in those courses? The quintile should be determined by calculating how many students have grades greater than or equal to each student's grade, then dividing this ranking by the total number of students who completed English courses. The quintiles should be labeled as "First" (top 20%), "Second" (top 21-40%), "Third" (top 41-60%), "Fourth" (top 61-80%), and "Fifth" (bottom 20%). Please sort the results from highest performing quintile to lowest (First to Fifth).
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local131 | EntertainmentAgency | SELECT
Musical_Styles.StyleName,
COUNT(RankedPreferences.FirstStyle)
AS FirstPreference,
COUNT(RankedPreferences.SecondStyle)
AS SecondPreference,
COUNT(RankedPreferences.ThirdStyle)
AS ThirdPreference
FROM Musical_Styles,
(SELECT (CASE WHEN
Musical_Preferences.PreferenceSeq = 1
THEN Musical_Preferences.StyleID
ELSE Null END) As FirstStyle,
(CASE WHEN
Musical_Preferences.PreferenceSeq = 2
THEN Musical_Preferences.StyleID
ELSE Null END) As SecondStyle,
(CASE WHEN
Musical_Preferences.PreferenceSeq = 3
THEN Musical_Preferences.StyleID
ELSE Null END) AS ThirdStyle
FROM Musical_Preferences) AS RankedPreferences
WHERE Musical_Styles.StyleID =
RankedPreferences.FirstStyle
OR Musical_Styles.StyleID =
RankedPreferences.SecondStyle
OR Musical_Styles.StyleID =
RankedPreferences.ThirdStyle
GROUP BY StyleID, StyleName
HAVING COUNT(FirstStyle) > 0
OR COUNT(SecondStyle) > 0
OR COUNT(ThirdStyle) > 0
ORDER BY FirstPreference DESC,
SecondPreference DESC,
ThirdPreference DESC, StyleID; | Could you list each musical style with the number of times it appears as a 1st, 2nd, or 3rd preference in a single row per style? | null | ['Agents' 'Customers' 'Engagements' 'Entertainer_Members'
'Entertainer_Styles' 'Entertainers' 'Members' 'Musical_Preferences'
'Musical_Styles' 'ztblDays' 'ztblMonths' 'ztblSkipLabels' 'ztblWeeks'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: EntertainmentAgency
2. **Tables**: Agents, Customers, Engagements, Entertainer_Members, Entertainer_Styles, Entertainers, Members, Musical_Preferences, Musical_Styles, ztblDays, ztblMonths, ztblSkipLabels, ztblWeeks
3. **User Question**: Could you list each musical style with the number of times it appears as a 1st, 2nd, or 3rd preference in a single row per style?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local133 | EntertainmentAgency | null | Given a database of musical styles and user preferences, where Musical_Preferences contains user rankings of musical styles (PreferenceSeq=1 for first choice, PreferenceSeq=2 for second choice, PreferenceSeq=3 for third choice): Calculate a weighted score for each musical style by assigning 3 points for each time it was ranked as first choice, 2 points for each second choice, and 1 point for each third choice ranking. Calculate the total weighted score for each musical style that has been ranked by at least one user. Then, compute the absolute difference between each style's total weighted score and the average total weighted score across all such styles. | null | ['Agents' 'Customers' 'Engagements' 'Entertainer_Members'
'Entertainer_Styles' 'Entertainers' 'Members' 'Musical_Preferences'
'Musical_Styles' 'ztblDays' 'ztblMonths' 'ztblSkipLabels' 'ztblWeeks'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: EntertainmentAgency
2. **Tables**: Agents, Customers, Engagements, Entertainer_Members, Entertainer_Styles, Entertainers, Members, Musical_Preferences, Musical_Styles, ztblDays, ztblMonths, ztblSkipLabels, ztblWeeks
3. **User Question**: Given a database of musical styles and user preferences, where Musical_Preferences contains user rankings of musical styles (PreferenceSeq=1 for first choice, PreferenceSeq=2 for second choice, PreferenceSeq=3 for third choice): Calculate a weighted score for each musical style by assigning 3 points for each time it was ranked as first choice, 2 points for each second choice, and 1 point for each third choice ranking. Calculate the total weighted score for each musical style that has been ranked by at least one user. Then, compute the absolute difference between each style's total weighted score and the average total weighted score across all such styles.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local132 | EntertainmentAgency | null | Show all pairs of entertainers and customers who each have up to three style strengths or preferences, where the first and second style preferences of the customers match the first and second style strengths of the entertainers (or in reverse order). Only return the entertainer’s stage name and the customer’s last name | null | ['Agents' 'Customers' 'Engagements' 'Entertainer_Members'
'Entertainer_Styles' 'Entertainers' 'Members' 'Musical_Preferences'
'Musical_Styles' 'ztblDays' 'ztblMonths' 'ztblSkipLabels' 'ztblWeeks'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: EntertainmentAgency
2. **Tables**: Agents, Customers, Engagements, Entertainer_Members, Entertainer_Styles, Entertainers, Members, Musical_Preferences, Musical_Styles, ztblDays, ztblMonths, ztblSkipLabels, ztblWeeks
3. **User Question**: Show all pairs of entertainers and customers who each have up to three style strengths or preferences, where the first and second style preferences of the customers match the first and second style strengths of the entertainers (or in reverse order). Only return the entertainer’s stage name and the customer’s last name
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local141 | AdventureWorks | null | How did each salesperson's annual total sales compare to their annual sales quota? Provide the difference between their total sales and the quota for each year, organized by salesperson and year. | null | ['salesperson' 'product' 'productmodelproductdescriptionculture'
'productdescription' 'productreview' 'productcategory'
'productsubcategory' 'salesorderdetail' 'salesorderheader'
'salesterritory' 'countryregioncurrency' 'currencyrate'
'SalesPersonQuotaHistory'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: AdventureWorks
2. **Tables**: salesperson, product, productmodelproductdescriptionculture, productdescription, productreview, productcategory, productsubcategory, salesorderdetail, salesorderheader, salesterritory, countryregioncurrency, currencyrate, SalesPersonQuotaHistory
3. **User Question**: How did each salesperson's annual total sales compare to their annual sales quota? Provide the difference between their total sales and the quota for each year, organized by salesperson and year.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local152 | imdb_movies | null | Can you provide the top 9 directors by movie count, including their ID, name, number of movies, average inter-movie duration (rounded to the nearest integer), average rating (rounded to 2 decimals), total votes, minimum and maximum ratings, and total movie duration? Sort the output first by movie count in descending order and then by total movie duration in descending order. | null | ['ERD' 'movies' 'genre' 'director_mapping' 'role_mapping' 'names'
'ratings'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: imdb_movies
2. **Tables**: ERD, movies, genre, director_mapping, role_mapping, names, ratings
3. **User Question**: Can you provide the top 9 directors by movie count, including their ID, name, number of movies, average inter-movie duration (rounded to the nearest integer), average rating (rounded to 2 decimals), total votes, minimum and maximum ratings, and total movie duration? Sort the output first by movie count in descending order and then by total movie duration in descending order.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local230 | imdb_movies | null | Determine the top three genres with the most movies rated above 8, and then identify the top four directors who have directed the most films rated above 8 within those genres. List these directors and their respective movie counts. | null | ['ERD' 'movies' 'genre' 'director_mapping' 'role_mapping' 'names'
'ratings'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: imdb_movies
2. **Tables**: ERD, movies, genre, director_mapping, role_mapping, names, ratings
3. **User Question**: Determine the top three genres with the most movies rated above 8, and then identify the top four directors who have directed the most films rated above 8 within those genres. List these directors and their respective movie counts.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local156 | bank_sales_trading | null | Analyze the annual average purchase price per Bitcoin by region, computed as the total dollar amount spent divided by the total quantity purchased each year, excluding the first year's data for each region. Then, for each year, rank the regions based on these average purchase prices, and calculate the annual percentage change in cost for each region compared to the previous year. | null | ['weekly_sales' 'shopping_cart_users' 'bitcoin_members' 'interest_metrics'
'customer_regions' 'customer_transactions' 'bitcoin_transactions'
'customer_nodes' 'cleaned_weekly_sales' 'veg_txn_df'
'shopping_cart_events' 'shopping_cart_page_hierarchy' 'bitcoin_prices'
'interest_map' 'veg_loss_rate_df' 'shopping_cart_campaign_identifier'
'veg_cat' 'veg_whsle_df' 'shopping_cart_event_identifier'
'daily_transactions' 'MonthlyMaxBalances' 'monthly_balances' 'attributes'
'sqlite_sequence' 'monthly_net' 'veg_wholesale_data' 'closing_balances'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: bank_sales_trading
2. **Tables**: weekly_sales, shopping_cart_users, bitcoin_members, interest_metrics, customer_regions, customer_transactions, bitcoin_transactions, customer_nodes, cleaned_weekly_sales, veg_txn_df, shopping_cart_events, shopping_cart_page_hierarchy, bitcoin_prices, interest_map, veg_loss_rate_df, shopping_cart_campaign_identifier, veg_cat, veg_whsle_df, shopping_cart_event_identifier, daily_transactions, MonthlyMaxBalances, monthly_balances, attributes, sqlite_sequence, monthly_net, veg_wholesale_data, closing_balances
3. **User Question**: Analyze the annual average purchase price per Bitcoin by region, computed as the total dollar amount spent divided by the total quantity purchased each year, excluding the first year's data for each region. Then, for each year, rank the regions based on these average purchase prices, and calculate the annual percentage change in cost for each region compared to the previous year.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local157 | bank_sales_trading | null | Using the "bitcoin_prices" table, please calculate the daily percentage change in trading volume for each ticker from August 1 to August 10, 2021, ensuring that any volume ending in "K" or "M" is accurately converted to thousands or millions, any "-" volume is treated as zero, only non-zero volumes are used to determine the previous day's volume, and the results are ordered by ticker and date. | null | ['weekly_sales' 'shopping_cart_users' 'bitcoin_members' 'interest_metrics'
'customer_regions' 'customer_transactions' 'bitcoin_transactions'
'customer_nodes' 'cleaned_weekly_sales' 'veg_txn_df'
'shopping_cart_events' 'shopping_cart_page_hierarchy' 'bitcoin_prices'
'interest_map' 'veg_loss_rate_df' 'shopping_cart_campaign_identifier'
'veg_cat' 'veg_whsle_df' 'shopping_cart_event_identifier'
'daily_transactions' 'MonthlyMaxBalances' 'monthly_balances' 'attributes'
'sqlite_sequence' 'monthly_net' 'veg_wholesale_data' 'closing_balances'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: bank_sales_trading
2. **Tables**: weekly_sales, shopping_cart_users, bitcoin_members, interest_metrics, customer_regions, customer_transactions, bitcoin_transactions, customer_nodes, cleaned_weekly_sales, veg_txn_df, shopping_cart_events, shopping_cart_page_hierarchy, bitcoin_prices, interest_map, veg_loss_rate_df, shopping_cart_campaign_identifier, veg_cat, veg_whsle_df, shopping_cart_event_identifier, daily_transactions, MonthlyMaxBalances, monthly_balances, attributes, sqlite_sequence, monthly_net, veg_wholesale_data, closing_balances
3. **User Question**: Using the "bitcoin_prices" table, please calculate the daily percentage change in trading volume for each ticker from August 1 to August 10, 2021, ensuring that any volume ending in "K" or "M" is accurately converted to thousands or millions, any "-" volume is treated as zero, only non-zero volumes are used to determine the previous day's volume, and the results are ordered by ticker and date.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local163 | education_business | WITH AvgSalaries AS (
SELECT
facrank AS FacRank,
AVG(facsalary) AS AvSalary
FROM
university_faculty
GROUP BY
facrank
),
SalaryDifferences AS (
SELECT
university_faculty.facrank AS FacRank,
university_faculty.facfirstname AS FacFirstName,
university_faculty.faclastname AS FacLastName,
university_faculty.facsalary AS Salary,
ABS(university_faculty.facsalary - AvgSalaries.AvSalary) AS Diff
FROM
university_faculty
JOIN
AvgSalaries ON university_faculty.facrank = AvgSalaries.FacRank
),
MinDifferences AS (
SELECT
FacRank,
MIN(Diff) AS MinDiff
FROM
SalaryDifferences
GROUP BY
FacRank
)
SELECT
s.FacRank,
s.FacFirstName,
s.FacLastName,
s.Salary
FROM
SalaryDifferences s
JOIN
MinDifferences m ON s.FacRank = m.FacRank AND s.Diff = m.MinDiff; | Which university faculty members' salaries are closest to the average salary for their respective ranks? Please provide the ranks, first names, last names, and salaries.university | null | ['hardware_dim_customer' 'hardware_fact_pre_invoice_deductions'
'web_sales_reps' 'hardware_dim_product' 'web_orders' 'StaffHours'
'university_enrollment' 'university_faculty' 'university_student'
'university_offering' 'web_accounts' 'web_events' 'SalaryDataset'
'web_region' 'hardware_fact_gross_price'
'hardware_fact_manufacturing_cost' 'university_course'
'hardware_fact_sales_monthly' 'NAMES'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: education_business
2. **Tables**: hardware_dim_customer, hardware_fact_pre_invoice_deductions, web_sales_reps, hardware_dim_product, web_orders, StaffHours, university_enrollment, university_faculty, university_student, university_offering, web_accounts, web_events, SalaryDataset, web_region, hardware_fact_gross_price, hardware_fact_manufacturing_cost, university_course, hardware_fact_sales_monthly, NAMES
3. **User Question**: Which university faculty members' salaries are closest to the average salary for their respective ranks? Please provide the ranks, first names, last names, and salaries.university
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local168 | city_legislation | null | Among job postings that specifically have the Data Analyst, require a non-null annual average salary, and are remote, what is the overall average salary when considering only the top three most frequently demanded skills for these positions? | null | ['aliens_details' 'skills_dim' 'legislators_terms' 'cities_currencies'
'legislators' 'skills_job_dim' 'job_postings_fact' 'alien_data'
'cities_countries' 'legislation_date_dim' 'cities' 'aliens_location'
'aliens' 'cities_languages' 'job_company' 'city_legislation'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: city_legislation
2. **Tables**: aliens_details, skills_dim, legislators_terms, cities_currencies, legislators, skills_job_dim, job_postings_fact, alien_data, cities_countries, legislation_date_dim, cities, aliens_location, aliens, cities_languages, job_company, city_legislation
3. **User Question**: Among job postings that specifically have the Data Analyst, require a non-null annual average salary, and are remote, what is the overall average salary when considering only the top three most frequently demanded skills for these positions?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local169 | city_legislation | null | What is the annual retention rate of legislators who began their first term between January 1, 1917 and December 31, 1999, measured as the proportion of this cohort still in office on December 31st for each of the first 20 years following their initial term start? The results should show all 20 periods in sequence regardless of whether any legislators were retained in a particular year. | null | ['aliens_details' 'skills_dim' 'legislators_terms' 'cities_currencies'
'legislators' 'skills_job_dim' 'job_postings_fact' 'alien_data'
'cities_countries' 'legislation_date_dim' 'cities' 'aliens_location'
'aliens' 'cities_languages' 'job_company' 'city_legislation'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: city_legislation
2. **Tables**: aliens_details, skills_dim, legislators_terms, cities_currencies, legislators, skills_job_dim, job_postings_fact, alien_data, cities_countries, legislation_date_dim, cities, aliens_location, aliens, cities_languages, job_company, city_legislation
3. **User Question**: What is the annual retention rate of legislators who began their first term between January 1, 1917 and December 31, 1999, measured as the proportion of this cohort still in office on December 31st for each of the first 20 years following their initial term start? The results should show all 20 periods in sequence regardless of whether any legislators were retained in a particular year.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local171 | city_legislation | null | For male legislators from Louisiana, how many distinct legislators were actively serving on December 31 of each year from more than 30 years since their first term up to less than 50 years, grouping the results by the exact number of years elapsed since their first term? | null | ['aliens_details' 'skills_dim' 'legislators_terms' 'cities_currencies'
'legislators' 'skills_job_dim' 'job_postings_fact' 'alien_data'
'cities_countries' 'legislation_date_dim' 'cities' 'aliens_location'
'aliens' 'cities_languages' 'job_company' 'city_legislation'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: city_legislation
2. **Tables**: aliens_details, skills_dim, legislators_terms, cities_currencies, legislators, skills_job_dim, job_postings_fact, alien_data, cities_countries, legislation_date_dim, cities, aliens_location, aliens, cities_languages, job_company, city_legislation
3. **User Question**: For male legislators from Louisiana, how many distinct legislators were actively serving on December 31 of each year from more than 30 years since their first term up to less than 50 years, grouping the results by the exact number of years elapsed since their first term?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local167 | city_legislation | null | Based on the state each female legislator first represented, which state has the highest number of female legislators whose terms included December 31st at any point, and what is that count? Please provide the state's abbreviation. | null | ['aliens_details' 'skills_dim' 'legislators_terms' 'cities_currencies'
'legislators' 'skills_job_dim' 'job_postings_fact' 'alien_data'
'cities_countries' 'legislation_date_dim' 'cities' 'aliens_location'
'aliens' 'cities_languages' 'job_company' 'city_legislation'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: city_legislation
2. **Tables**: aliens_details, skills_dim, legislators_terms, cities_currencies, legislators, skills_job_dim, job_postings_fact, alien_data, cities_countries, legislation_date_dim, cities, aliens_location, aliens, cities_languages, job_company, city_legislation
3. **User Question**: Based on the state each female legislator first represented, which state has the highest number of female legislators whose terms included December 31st at any point, and what is that count? Please provide the state's abbreviation.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local170 | city_legislation | null | Identify the state abbreviations where, for both male and female legislators, the retention rate remains greater than zero at specific intervals of 0, 2, 4, 6, 8, and 10 years after their first term start date. A legislator is considered retained if they are serving on December 31 of the respective year. Only include states where both gender cohorts maintain non-zero retention rates at all six of these time points during the first decade of service. | null | ['aliens_details' 'skills_dim' 'legislators_terms' 'cities_currencies'
'legislators' 'skills_job_dim' 'job_postings_fact' 'alien_data'
'cities_countries' 'legislation_date_dim' 'cities' 'aliens_location'
'aliens' 'cities_languages' 'job_company' 'city_legislation'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: city_legislation
2. **Tables**: aliens_details, skills_dim, legislators_terms, cities_currencies, legislators, skills_job_dim, job_postings_fact, alien_data, cities_countries, legislation_date_dim, cities, aliens_location, aliens, cities_languages, job_company, city_legislation
3. **User Question**: Identify the state abbreviations where, for both male and female legislators, the retention rate remains greater than zero at specific intervals of 0, 2, 4, 6, 8, and 10 years after their first term start date. A legislator is considered retained if they are serving on December 31 of the respective year. Only include states where both gender cohorts maintain non-zero retention rates at all six of these time points during the first decade of service.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local193 | sqlite-sakila | null | Could you find out the average percentage of the total lifetime sales (LTV) that occur in the first 7 and 30 days after a customer's initial purchase? Also, include the average total lifetime sales (LTV). Please exclude customers with zero lifetime sales. The 7- and 30-day periods should be based on the exact number of hours-minutes-seconds, not calendar days. | null | ['actor' 'country' 'city' 'address' 'language' 'category' 'customer'
'film' 'film_actor' 'film_category' 'film_text' 'inventory' 'staff'
'store' 'payment' 'rental' 'monthly_payment_totals' 'MonthlyTotals'
'total_revenue_by_film'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: sqlite-sakila
2. **Tables**: actor, country, city, address, language, category, customer, film, film_actor, film_category, film_text, inventory, staff, store, payment, rental, monthly_payment_totals, MonthlyTotals, total_revenue_by_film
3. **User Question**: Could you find out the average percentage of the total lifetime sales (LTV) that occur in the first 7 and 30 days after a customer's initial purchase? Also, include the average total lifetime sales (LTV). Please exclude customers with zero lifetime sales. The 7- and 30-day periods should be based on the exact number of hours-minutes-seconds, not calendar days.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local194 | sqlite-sakila | null | Please provide a list of the top three revenue-generating films for each actor, along with the average revenue per actor in those films, calculated by dividing the total film revenue equally among the actors for each film. | null | ['actor' 'country' 'city' 'address' 'language' 'category' 'customer'
'film' 'film_actor' 'film_category' 'film_text' 'inventory' 'staff'
'store' 'payment' 'rental' 'monthly_payment_totals' 'MonthlyTotals'
'total_revenue_by_film'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: sqlite-sakila
2. **Tables**: actor, country, city, address, language, category, customer, film, film_actor, film_category, film_text, inventory, staff, store, payment, rental, monthly_payment_totals, MonthlyTotals, total_revenue_by_film
3. **User Question**: Please provide a list of the top three revenue-generating films for each actor, along with the average revenue per actor in those films, calculated by dividing the total film revenue equally among the actors for each film.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local195 | sqlite-sakila | null | Please find out how widespread the appeal of our top five actors is. What percentage of our customers have rented films featuring these actors? | null | ['actor' 'country' 'city' 'address' 'language' 'category' 'customer'
'film' 'film_actor' 'film_category' 'film_text' 'inventory' 'staff'
'store' 'payment' 'rental' 'monthly_payment_totals' 'MonthlyTotals'
'total_revenue_by_film'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: sqlite-sakila
2. **Tables**: actor, country, city, address, language, category, customer, film, film_actor, film_category, film_text, inventory, staff, store, payment, rental, monthly_payment_totals, MonthlyTotals, total_revenue_by_film
3. **User Question**: Please find out how widespread the appeal of our top five actors is. What percentage of our customers have rented films featuring these actors?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local196 | sqlite-sakila | null | For each rating category of the first movie rented by customers—where the first movie is identified based on the earliest payment date per customer—please provide the average total amount spent per customer and the average number of subsequent rentals (calculated as the total number of rentals minus one) for customers whose first rented movie falls into that rating category. | null | ['actor' 'country' 'city' 'address' 'language' 'category' 'customer'
'film' 'film_actor' 'film_category' 'film_text' 'inventory' 'staff'
'store' 'payment' 'rental' 'monthly_payment_totals' 'MonthlyTotals'
'total_revenue_by_film'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: sqlite-sakila
2. **Tables**: actor, country, city, address, language, category, customer, film, film_actor, film_category, film_text, inventory, staff, store, payment, rental, monthly_payment_totals, MonthlyTotals, total_revenue_by_film
3. **User Question**: For each rating category of the first movie rented by customers—where the first movie is identified based on the earliest payment date per customer—please provide the average total amount spent per customer and the average number of subsequent rentals (calculated as the total number of rentals minus one) for customers whose first rented movie falls into that rating category.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local197 | sqlite-sakila | WITH result_table AS (
SELECT
strftime('%m', pm.payment_date) AS pay_mon,
customer_id,
COUNT(pm.amount) AS pay_countpermon,
SUM(pm.amount) AS pay_amount
FROM
payment AS pm
GROUP BY
pay_mon,
customer_id
),
top10_customer AS (
SELECT
customer_id,
SUM(tb.pay_amount) AS total_payments
FROM
result_table AS tb
GROUP BY
customer_id
ORDER BY
SUM(tb.pay_amount) DESC
LIMIT
10
),
difference_per_mon AS (
SELECT
pay_mon AS month_number,
pay_mon AS month,
tb.pay_countpermon,
tb.pay_amount,
ABS(tb.pay_amount - LAG(tb.pay_amount) OVER (PARTITION BY tb.customer_id)) AS diff
FROM
result_table tb
JOIN top10_customer top ON top.customer_id = tb.customer_id
)
SELECT
month,
ROUND(max_diff, 2) AS max_diff
FROM (
SELECT
month,
diff,
month_number,
MAX(diff) OVER (PARTITION BY month) AS max_diff
FROM
difference_per_mon
) AS max_per_mon
WHERE
diff = max_diff
ORDER BY
max_diff DESC
LIMIT
1; | Among our top 10 paying customers, can you identify the largest change in payment amounts from one month to the immediately following month? Specifically, please determine for which customer and during which month this maximum month-over-month difference occurred, and provide the difference rounded to two decimal places. | null | ['actor' 'country' 'city' 'address' 'language' 'category' 'customer'
'film' 'film_actor' 'film_category' 'film_text' 'inventory' 'staff'
'store' 'payment' 'rental' 'monthly_payment_totals' 'MonthlyTotals'
'total_revenue_by_film'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: sqlite-sakila
2. **Tables**: actor, country, city, address, language, category, customer, film, film_actor, film_category, film_text, inventory, staff, store, payment, rental, monthly_payment_totals, MonthlyTotals, total_revenue_by_film
3. **User Question**: Among our top 10 paying customers, can you identify the largest change in payment amounts from one month to the immediately following month? Specifically, please determine for which customer and during which month this maximum month-over-month difference occurred, and provide the difference rounded to two decimal places.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local199 | sqlite-sakila | WITH result_table AS (
SELECT
strftime('%Y', RE.RENTAL_DATE) AS YEAR,
strftime('%m', RE.RENTAL_DATE) AS RENTAL_MONTH,
ST.STORE_ID,
COUNT(RE.RENTAL_ID) AS count
FROM
RENTAL RE
JOIN STAFF ST ON RE.STAFF_ID = ST.STAFF_ID
GROUP BY
YEAR,
RENTAL_MONTH,
ST.STORE_ID
),
monthly_sales AS (
SELECT
YEAR,
RENTAL_MONTH,
STORE_ID,
SUM(count) AS total_rentals
FROM
result_table
GROUP BY
YEAR,
RENTAL_MONTH,
STORE_ID
),
store_max_sales AS (
SELECT
STORE_ID,
YEAR,
RENTAL_MONTH,
total_rentals,
MAX(total_rentals) OVER (PARTITION BY STORE_ID) AS max_rentals
FROM
monthly_sales
)
SELECT
STORE_ID,
YEAR,
RENTAL_MONTH,
total_rentals
FROM
store_max_sales
WHERE
total_rentals = max_rentals
ORDER BY
STORE_ID; | Can you identify the year and month with the highest rental orders created by the store's staff for each store? Please list the store ID, the year, the month, and the total rentals for those dates. | null | ['actor' 'country' 'city' 'address' 'language' 'category' 'customer'
'film' 'film_actor' 'film_category' 'film_text' 'inventory' 'staff'
'store' 'payment' 'rental' 'monthly_payment_totals' 'MonthlyTotals'
'total_revenue_by_film'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: sqlite-sakila
2. **Tables**: actor, country, city, address, language, category, customer, film, film_actor, film_category, film_text, inventory, staff, store, payment, rental, monthly_payment_totals, MonthlyTotals, total_revenue_by_film
3. **User Question**: Can you identify the year and month with the highest rental orders created by the store's staff for each store? Please list the store ID, the year, the month, and the total rentals for those dates.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local201 | modern_data | null | Identify the first 10 words, sorted alphabetically, that are 4 to 5 characters long, start with 'r', and have at least one anagram of the same length, considering case-sensitive letters. Provide the count of such anagrams for each word. | null | ['pizza_names' 'companies_funding' 'pizza_customer_orders'
'pizza_toppings' 'trees' 'pizza_recipes' 'statistics' 'income_trees'
'pizza_clean_runner_orders' 'pizza_runner_orders' 'word_list'
'companies_dates' 'pizza_get_extras' 'pizza_get_exclusions'
'pizza_clean_customer_orders' 'companies_industries' 'pizza_runners'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: modern_data
2. **Tables**: pizza_names, companies_funding, pizza_customer_orders, pizza_toppings, trees, pizza_recipes, statistics, income_trees, pizza_clean_runner_orders, pizza_runner_orders, word_list, companies_dates, pizza_get_extras, pizza_get_exclusions, pizza_clean_customer_orders, companies_industries, pizza_runners
3. **User Question**: Identify the first 10 words, sorted alphabetically, that are 4 to 5 characters long, start with 'r', and have at least one anagram of the same length, considering case-sensitive letters. Provide the count of such anagrams for each word.
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local202 | city_legislation | null | For alien data, how many of the top 10 states by alien population have a higher percentage of friendly aliens than hostile aliens, with an average alien age exceeding 200? | null | ['aliens_details' 'skills_dim' 'legislators_terms' 'cities_currencies'
'legislators' 'skills_job_dim' 'job_postings_fact' 'alien_data'
'cities_countries' 'legislation_date_dim' 'cities' 'aliens_location'
'aliens' 'cities_languages' 'job_company' 'city_legislation'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: city_legislation
2. **Tables**: aliens_details, skills_dim, legislators_terms, cities_currencies, legislators, skills_job_dim, job_postings_fact, alien_data, cities_countries, legislation_date_dim, cities, aliens_location, aliens, cities_languages, job_company, city_legislation
3. **User Question**: For alien data, how many of the top 10 states by alien population have a higher percentage of friendly aliens than hostile aliens, with an average alien age exceeding 200?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local209 | delivery_center | null | In the dataset of orders joined with store information, which store has the highest total number of orders, and among that store’s orders, what is the ratio of orders that appear in the deliveries table with a 'DELIVERED' status to the total orders for that store? | null | ['channels' 'drivers' 'deliveries' 'hubs' 'payments' 'stores' 'orders'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: delivery_center
2. **Tables**: channels, drivers, deliveries, hubs, payments, stores, orders
3. **User Question**: In the dataset of orders joined with store information, which store has the highest total number of orders, and among that store’s orders, what is the ratio of orders that appear in the deliveries table with a 'DELIVERED' status to the total orders for that store?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local210 | delivery_center | WITH february_orders AS (
SELECT
h.hub_name AS hub_name,
COUNT(*) AS orders_february
FROM
orders o
LEFT JOIN
stores s ON o.store_id = s.store_id
LEFT JOIN
hubs h ON s.hub_id = h.hub_id
WHERE o.order_created_month = 2 AND o.order_status = 'FINISHED'
GROUP BY
h.hub_name
),
march_orders AS (
SELECT
h.hub_name AS hub_name,
COUNT(*) AS orders_march
FROM
orders o
LEFT JOIN
stores s ON o.store_id = s.store_id
LEFT JOIN
hubs h ON s.hub_id = h.hub_id
WHERE o.order_created_month = 3 AND o.order_status = 'FINISHED'
GROUP BY
h.hub_name
)
SELECT
fo.hub_name
FROM
february_orders fo
LEFT JOIN
march_orders mo ON fo.hub_name = mo.hub_name
WHERE
fo.orders_february > 0 AND
mo.orders_march > 0 AND
(CAST((mo.orders_march - fo.orders_february) AS REAL) / CAST(fo.orders_february AS REAL)) > 0.2 -- Filter for hubs with more than a 20% increase | Can you identify the hubs that saw more than a 20% increase in finished orders from February to March? | null | ['channels' 'drivers' 'deliveries' 'hubs' 'payments' 'stores' 'orders'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: delivery_center
2. **Tables**: channels, drivers, deliveries, hubs, payments, stores, orders
3. **User Question**: Can you identify the hubs that saw more than a 20% increase in finished orders from February to March?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local212 | delivery_center | null | Can you find 5 delivery drivers with the highest average number of daily deliveries? | null | ['channels' 'drivers' 'deliveries' 'hubs' 'payments' 'stores' 'orders'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: delivery_center
2. **Tables**: channels, drivers, deliveries, hubs, payments, stores, orders
3. **User Question**: Can you find 5 delivery drivers with the highest average number of daily deliveries?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local218 | EU_soccer | null | Can you calculate the median from the highest season goals of each team? | null | ['sqlite_sequence' 'Player_Attributes' 'Player' 'Match' 'League' 'Country'
'Team' 'Team_Attributes'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: EU_soccer
2. **Tables**: sqlite_sequence, Player_Attributes, Player, Match, League, Country, Team, Team_Attributes
3. **User Question**: Can you calculate the median from the highest season goals of each team?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
local219 | EU_soccer | WITH match_view AS(
SELECT
M.id,
L.name AS league,
M.season,
M.match_api_id,
T.team_long_name AS home_team,
TM.team_long_name AS away_team,
M.home_team_goal,
M.away_team_goal,
P1.player_name AS home_gk,
P2.player_name AS home_center_back_1,
P3.player_name AS home_center_back_2,
P4.player_name AS home_right_back,
P5.player_name AS home_left_back,
P6.player_name AS home_midfield_1,
P7.player_name AS home_midfield_2,
P8.player_name AS home_midfield_3,
P9.player_name AS home_midfield_4,
P10.player_name AS home_second_forward,
P11.player_name AS home_center_forward,
P12.player_name AS away_gk,
P13.player_name AS away_center_back_1,
P14.player_name AS away_center_back_2,
P15.player_name AS away_right_back,
P16.player_name AS away_left_back,
P17.player_name AS away_midfield_1,
P18.player_name AS away_midfield_2,
P19.player_name AS away_midfield_3,
P20.player_name AS away_midfield_4,
P21.player_name AS away_second_forward,
P22.player_name AS away_center_forward,
M.goal,
M.card
FROM
match M
LEFT JOIN
league L ON M.league_id = L.id
LEFT JOIN
team T ON M.home_team_api_id = T.team_api_id
LEFT JOIN
team TM ON M.away_team_api_id = TM.team_api_id
LEFT JOIN
player P1 ON M.home_player_1 = P1.player_api_id
LEFT JOIN
player P2 ON M.home_player_2 = P2.player_api_id
LEFT JOIN
player P3 ON M.home_player_3 = P3.player_api_id
LEFT JOIN
player P4 ON M.home_player_4 = P4.player_api_id
LEFT JOIN
player P5 ON M.home_player_5 = P5.player_api_id
LEFT JOIN
player P6 ON M.home_player_6 = P6.player_api_id
LEFT JOIN
player P7 ON M.home_player_7 = P7.player_api_id
LEFT JOIN
player P8 ON M.home_player_8 = P8.player_api_id
LEFT JOIN
player P9 ON M.home_player_9 = P9.player_api_id
LEFT JOIN
player P10 ON M.home_player_10 = P10.player_api_id
LEFT JOIN
player P11 ON M.home_player_11 = P11.player_api_id
LEFT JOIN
player P12 ON M.away_player_1 = P12.player_api_id
LEFT JOIN
player P13 ON M.away_player_2 = P13.player_api_id
LEFT JOIN
player P14 ON M.away_player_3 = P14.player_api_id
LEFT JOIN
player P15 ON M.away_player_4 = P15.player_api_id
LEFT JOIN
player P16 ON M.away_player_5 = P16.player_api_id
LEFT JOIN
player P17 ON M.away_player_6 = P17.player_api_id
LEFT JOIN
player P18 ON M.away_player_7 = P18.player_api_id
LEFT JOIN
player P19 ON M.away_player_8 = P19.player_api_id
LEFT JOIN
player P20 ON M.away_player_9 = P20.player_api_id
LEFT JOIN
player P21 ON M.away_player_10 = P21.player_api_id
LEFT JOIN
player P22 ON M.away_player_11 = P22.player_api_id
),
match_score AS
(
SELECT -- Displaying teams and their goals as home_team
id,
home_team AS team,
CASE
WHEN home_team_goal > away_team_goal THEN 1 ELSE 0 END AS Winning_match
FROM
match_view
UNION ALL
SELECT -- Displaying teams and their goals as away_team
id,
away_team AS team,
CASE
WHEN away_team_goal > home_team_goal THEN 1 ELSE 0 END AS Winning_match
FROM
match_view
),
winning_matches AS
(
SELECT -- Displaying total match wins for each team
MV.league,
M.team,
COUNT(CASE WHEN M.Winning_match = 1 THEN 1 END) AS wins,
ROW_NUMBER() OVER(PARTITION BY MV.league ORDER BY COUNT(CASE WHEN M.Winning_match = 1 THEN 1 END) ASC) AS rn
FROM
match_score M
JOIN
match_view MV
ON
M.id = MV.id
GROUP BY
MV.league,
team
ORDER BY
league,
wins ASC
)
SELECT
league,
team
FROM
winning_matches
WHERE
rn = 1 -- Getting the team with the least number of wins in each league
ORDER BY
league; | In each league, considering all seasons, which single team has the fewest total match wins based on comparing home and away goals, including teams with zero wins, ensuring that if multiple teams tie for the fewest wins, only one team is returned for each league? | null | ['sqlite_sequence' 'Player_Attributes' 'Player' 'Match' 'League' 'Country'
'Team' 'Team_Attributes'] |
Solve the given problem according to instructions given above:
## Your SYSTEM Inputs
1. **Database**: EU_soccer
2. **Tables**: sqlite_sequence, Player_Attributes, Player, Match, League, Country, Team, Team_Attributes
3. **User Question**: In each league, considering all seasons, which single team has the fewest total match wins based on comparing home and away goals, including teams with zero wins, ensuring that if multiple teams tie for the fewest wins, only one team is returned for each league?
## OUTPUT FORMAT
You should always return a json in the following format:
```json
{
"previous_step_summary": "...",
"reasoning": "...",
"task": "...",
"sql": "```sql...```"
}
```
## START THE WORKFLOW NOW BY PROPOSING A PLAN AND TAKING FIRST STEP TO SOLVE GIVEN SQLITE PROBLEM (in json format as mentioned above)
|
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 10