Text-to-SQL
Collection
2 items • Updated
question_id stringlengths 1 4 | question stringlengths 23 278 | evidence stringlengths 24 468 ⌀ | SQL stringlengths 41 1.25k | db_id stringclasses 11
values | original_question stringclasses 88
values | original_evidence stringclasses 98
values | original_SQL stringlengths 29 782 ⌀ |
|---|---|---|---|---|---|---|---|
1471 | What is the ratio of customers who pay in EUR against customers who pay in CZK? | ratio of customers who pay in EUR against customers who pay in CZK = count(Currency = 'EUR') / count(Currency = 'CZK'). | SELECT CAST(SUM(IIF(Currency = 'EUR', 1, 0)) AS FLOAT) / SUM(IIF(Currency = 'CZK', 1, 0)) AS ratio FROM customers | debit_card_specializing | null | null | null |
1472 | In 2012, who had the least consumption in LAM? | Year 2012 can be presented as Between 201201 And 201212; The first 4 strings of the Date values in the yearmonth table can represent year. | SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'LAM' AND SUBSTR(T2.Date, 1, 4) = '2012' GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) ASC LIMIT 1 | debit_card_specializing | null | null | null |
1473 | What was the average monthly consumption of customers in SME for the year 2013? | Average Monthly consumption = AVG(SUM(Consumption) by CustomerID) / 12; Year 2013 can be presented as Between 201301 And 201312; The first 4 strings of the Date values in the yearmonth table can represent year. | SELECT AVG(TotalConsumption) / 12 FROM (SELECT SUM(T2.Consumption) AS TotalConsumption FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTR(T2.Date, 1, 4) = '2013' AND T1.Segment = 'SME' GROUP BY T1.CustomerID) | debit_card_specializing | null | null | null |
1476 | What was the difference in gas consumption between CZK-paying customers and EUR-paying customers in 2012? | Year 2012 can be presented as Between 201201 And 201212; The first 4 strings of the Date values in the yearmonth table can represent year; Difference in Consumption = CZK customers consumption in 2012 - EUR customers consumption in 2012 | SELECT SUM(IIF(T1.Currency = 'CZK', T2.Consumption, 0)) - SUM(IIF(T1.Currency = 'EUR', T2.Consumption, 0)) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTR(T2.Date, 1, 4) = '2012' | debit_card_specializing | null | null | null |
1479 | Which year recorded the most consumption of gas paid in CZK? | The first 4 strings of the Date values in the yearmonth table can represent year. | SELECT SUBSTR(T2.Date, 1, 4) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'CZK' GROUP BY SUBSTR(T2.Date, 1, 4) ORDER BY SUM(T2.Consumption) DESC LIMIT 1 | debit_card_specializing | null | null | null |
1480 | What was the gas consumption peak month for SME customers in 2013? | Year 2013 can be presented as Between 201301 And 201312; The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month. | SELECT SUBSTR(T2.Date, 5, 2) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTR(T2.Date, 1, 4) = '2013' AND T1.Segment = 'SME' GROUP BY SUBSTR(T2.Date, 5, 2) ORDER BY SUM(T2.Consumption) DESC LIMIT 1 | debit_card_specializing | null | null | null |
1481 | What is the difference in the annual average consumption of the customers with the least amount of consumption paid in CZK for 2013 between SME and LAM, LAM and KAM, and KAM and SME? | annual average consumption of customer with the lowest consumption in each segment = total consumption per year / the number of customer with lowest consumption in each segment; Difference in annual average = SME's annual average - LAM's annual average; Difference in annual average = LAM's annual average - KAM's annual... | WITH customer_consumption AS (SELECT c.Segment, c.CustomerID, SUM(ym.Consumption) AS TotalConsumption, COUNT(DISTINCT ym.CustomerID) AS CustomerCount FROM customers AS c JOIN yearmonth AS ym ON c.CustomerID = ym.CustomerID WHERE ym.Date BETWEEN '201301' AND '201312' AND c.Currency = 'CZK' GROUP BY c.Segment, c.Customer... | debit_card_specializing | null | null | null |
1482 | Provide the percentage increase in consumption paid in EUR between 2012 and 2013 for SME, LAM, and KAM respectively. | Increase = consumption for 2013 - consumption for 2012; Percentage of Increase = (Increase / consumption for 2012) * 100%; The first 4 strings of the Date values in the yearmonth table can represent year | SELECT CAST((SUM(IIF(T1.Segment = 'SME' AND T2.Date LIKE '2013%', T2.Consumption, 0)) - SUM(IIF(T1.Segment = 'SME' AND T2.Date LIKE '2012%', T2.Consumption, 0))) AS FLOAT) * 100 / SUM(IIF(T1.Segment = 'SME' AND T2.Date LIKE '2012%', T2.Consumption, 0)), CAST(SUM(IIF(T1.Segment = 'LAM' AND T2.Date LIKE '2013%', T2.Consu... | debit_card_specializing | Provide the percentage increase or decrease in consumption paid in EUR between 2012 and 2013 for SME, LAM, and KAM respectively. | Increase or Decrease = consumption for 2013 - consumption for 2012; Percentage of Increase = (Increase or Decrease / consumption for 2012) * 100%; The first 4 strings of the Date values in the yearmonth table can represent year | null |
1483 | How much did customer 6 consume in total between August and November 2013? | Between August And November 2013 refers to Between 201308 And 201311; The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month. | SELECT SUM(Consumption) FROM yearmonth WHERE CustomerID = 6 AND Date BETWEEN '201308' AND '201311' | debit_card_specializing | null | null | null |
1484 | How many more "discount" gas stations does the Czech Republic have compared to Slovakia? | Czech Republic can be represented as the Country value in gasstations table is 'CZE'; Slovakia can be represented as the Country value in the gasstations table is 'SVK'; Computation of more "discount" gas stations= Total no. of discount gas stations in Czech Republic - Total no. of discount gas stations in Slovakia | SELECT SUM(IIF(Country = 'CZE', 1, 0)) - SUM(IIF(Country = 'SVK', 1, 0)) FROM gasstations WHERE Segment = 'Discount' | debit_card_specializing | null | null | null |
1486 | How much more SMEs pay in Czech koruna than in euros? | Amount of more SMEs = Total of SMEs pay using Currency CZK - Total of SMEs pay using Currency EUR | SELECT SUM(Currency = 'CZK') - SUM(Currency = 'EUR') FROM customers WHERE Segment = 'SME' | debit_card_specializing | Is it true that more SMEs pay in Czech koruna than in euros? If so, how many more? | null | null |
1490 | What percentage of LAM customers consumed more than 46.73 in at least one month? | Percentage of LAM customer consumed more than 46.73 = (Total no. of LAM customers who consumed more than 46.73 / Total no. of LAM customers) * 100. | SELECT CAST(COUNT(DISTINCT IIF(T2.Consumption > 46.73, T1.CustomerID, NULL)) AS REAL) * 100 / COUNT(DISTINCT T1.CustomerID) FROM customers AS T1 LEFT JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'LAM' | debit_card_specializing | How many percent of LAM customer consumed more than 46.73? | null | null |
1493 | In February 2012, what percentage of customers consumed more than 528.3? | February 2012 refers to '201202' in yearmonth.date; The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month. | SELECT CAST(SUM(IIF(Consumption > 528.3, 1, 0)) AS FLOAT) * 100 / COUNT(CustomerID) FROM yearmonth WHERE Date = '201202' | debit_card_specializing | null | null | null |
1498 | What is the highest monthly consumption in the year 2012? | The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month. | SELECT SUM(Consumption) FROM yearmonth WHERE SUBSTR(Date, 1, 4) = '2012' GROUP BY SUBSTR(Date, 5, 2) ORDER BY SUM(Consumption) DESC LIMIT 1 | debit_card_specializing | null | null | null |
1500 | Please list the product descriptions of the products purchased in August, 2012. | August 2012 refers to Date like '2012-08-%' | SELECT DISTINCT T3.Description FROM transactions_1k AS T1 INNER JOIN products AS T3 ON T1.ProductID = T3.ProductID WHERE T1.Date LIKE '2012-08-%' | debit_card_specializing | null | null | null |
1501 | Please list the countries of the gas stations with transactions taken place in August, 2012. | August 2012 refers to Date like '2012-08-%' | SELECT DISTINCT T2.Country FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.Date LIKE '2012-08-%' | debit_card_specializing | null | null | null |
1505 | Among customers who paid in euros, how many have at least one month with consumption over 1000? | Pays in euro = Currency = 'EUR'. | SELECT COUNT(DISTINCT T1.CustomerID) FROM yearmonth AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Currency = 'EUR' AND T1.Consumption > 1000.00 | debit_card_specializing | Among the customers who paid in euro, how many of them have a monthly consumption of over 1000? | null | null |
1506 | Please list the product descriptions of the transactions taken place in the gas stations in the Czech Republic. | Czech Republic can be represented as the Country value in the gasstations table is 'CZE'; | SELECT DISTINCT T3.Description FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID INNER JOIN products AS T3 ON T1.ProductID = T3.ProductID WHERE T2.Country = 'CZE' | debit_card_specializing | null | null | null |
1507 | Please list the disparate time of the transactions taken place in the gas stations from chain no. 11. | null | SELECT DISTINCT T1.Time FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T2.ChainID = 11 | debit_card_specializing | null | null | null |
1509 | Among the transactions made in the gas stations in the Czech Republic, how many of them are taken place after 2012/1/1? | Czech Republic can be represented as the Country value in the gasstations table is 'CZE' | SELECT COUNT(t.`TransactionID`)
FROM `transactions_1k` AS t
JOIN `gasstations` AS g
ON t.`GasStationID` = g.`GasStationID`
WHERE g.`Country` = 'CZE'
AND DATE(t.`Date`) > '2012-01-01'; | debit_card_specializing | null | null | SELECT COUNT(T1.TransactionID) FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T2.Country = 'CZE' AND STRFTIME('%Y', T1.Date) >= '2012' |
1514 | What kind of currency did the customer paid at 16:25:00 in 2012/8/24? | '2012/8/24' can be represented by '2012-08-24'; | SELECT DISTINCT T3.Currency FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID INNER JOIN customers AS T3 ON T1.CustomerID = T3.CustomerID WHERE T1.Date = '2012-08-24' AND T1.Time = '16:25:00' | debit_card_specializing | null | null | null |
1515 | What segment did the customer have at 2012/8/23 21:20:00? | '2012/8/23' can be represented by '2012-08-23' | SELECT T2.Segment FROM transactions_1k AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.date = '2012-08-23' AND T1.time = '21:20:00' | debit_card_specializing | null | null | null |
1521 | For all the transactions happened during 8:00-9:00 in 2012/8/26, how many happened in CZE? | Czech Republic can be represented as the Country value in the gasstations table is 'CZE'; '2012/8/26' can be represented by '2012-08-26'; during 8:00-9:00 can be represented as Time BETWEEN '08:00:00' AND '09:00:00' | SELECT COUNT(T1.TransactionID) FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.Date = '2012-08-26' AND T1.Time BETWEEN '08:00:00' AND '09:00:00' AND T2.Country = 'CZE' | debit_card_specializing | null | null | null |
1524 | What's the segment of the customer who spent 548.4 in 2012/8/24? | '2012/8/24' can be represented by '2012-08-24' | SELECT T2.Segment FROM transactions_1k AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Date = '2012-08-24' AND T1.Price = 548.4 | debit_card_specializing | What's the nationality of the customer who spent 548.4 in 2012/8/24? | null | SELECT T2.Country FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.Date = '2012-08-24' AND T1.Price = 548.4 |
1525 | What percentage of customers who made at least one transaction on 2012-08-25 used EUR on that date? | '2012/8/25' can be represented by '2012-08-25' | SELECT CAST(COUNT(DISTINCT IIF(T2.Currency = 'EUR', T1.CustomerID, NULL)) AS FLOAT) * 100 / COUNT(DISTINCT T1.CustomerID) FROM transactions_1k AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Date = '2012-08-25' | debit_card_specializing | What is the percentage of the customers who used EUR in 2012/8/25? | null | null |
1526 | For the customer who paid 634.8 in 2012/8/25, what was the consumption decrease rate from Year 2012 to 2013? | '2012/8/24' can be represented by '2012-08-24'; Consumption decrease rate = (consumption_2012 - consumption_2013) / consumption_2012 | SELECT CAST(SUM(IIF(SUBSTRING(Date, 1, 4) = '2012', Consumption, 0)) - SUM(IIF(SUBSTRING(Date, 1, 4) = '2013', Consumption, 0)) AS FLOAT) / SUM(IIF(SUBSTRING(Date, 1, 4) = '2012', Consumption, 0)) FROM yearmonth WHERE CustomerID = ( SELECT T1.CustomerID FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasS... | debit_card_specializing | null | null | null |
1528 | What is the percentage of "premium" against the overall segment in Country = "SVK"? | null | SELECT CAST(SUM(IIF(Country = 'SVK' AND Segment = 'Premium', 1, 0)) AS FLOAT) * 100 / SUM(IIF(Country = 'SVK', 1, 0)) FROM gasstations | debit_card_specializing | null | null | null |
1529 | What is the amount spent by customer "38508" at the gas stations? How much had the customer spent in August 2012? | August 2012 refers to the Date value starts with '2012-08' | SELECT SUM(Amount * Price) AS total_spent, SUM(CASE WHEN Date LIKE '2012-08%' THEN Amount * Price ELSE 0 END) AS august_2012_spent FROM transactions_1k WHERE CustomerID = 38508 | debit_card_specializing | null | August 2012 refers to the Date value = '201208' | SELECT SUM(T1.Price), SUM(IIF(T1.Date LIKE '2012-08%', T1.Price, 0)) FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.CustomerID = '38508' |
1531 | Who is the top spending customer and how much is the average price per single item purchased by this customer? What currency was being used? | average price per single item = Total(price) / Total(amount) | SELECT c.CustomerID, SUM(t.Price * t.Amount) / SUM(t.Amount) AS average_price_per_item, c.Currency FROM transactions_1k AS t JOIN customers AS c ON t.CustomerID = c.CustomerID WHERE t.CustomerID = ( SELECT CustomerID FROM transactions_1k GROUP BY CustomerID ORDER BY SUM(Amount * Price) DESC LIMIT 1 ) GROUP BY c.Custome... | debit_card_specializing | null | null | SELECT t.CustomerID AS CustomerID, CAST(SUM(t.Price) AS REAL) / SUM(t.Amount) AS AvgPricePerItem, c.Currency AS Currency FROM transactions_1k AS t JOIN customers AS c ON t.CustomerID = c.CustomerID WHERE t.CustomerID = (SELECT CustomerID FROM (SELECT CustomerID, SUM(Price) AS TotalSpending FROM transactions_1k GROUP BY... |
1533 | For all the people who paid more than 29.00 per unit of product id No.5. Give their consumption status in the August of 2012. | August of 2012 refers to the Date value = '201208' ; Price per unit of product = Price / Amount; | SELECT T2.Consumption FROM transactions_1k AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Price / T1.Amount > 29.00 AND T1.ProductID = 5 AND T2.Date = '201208' | debit_card_specializing | null | null | null |
1312 | What's Angela Sanders's major? | Angela Sanders is the full name; full name refers to first_name, last_name; major refers to major_name. | SELECT T2.major_name FROM member AS T1 INNER JOIN major AS T2 ON T1.link_to_major = T2.major_id WHERE T1.first_name = 'Angela' AND T1.last_name = 'Sanders' | student_club | null | null | null |
1317 | Among the students from the Student_Club who attended the event "Women's Soccer", how many of them want a T-shirt that's in medium size? | Women's Soccer is an event name; T-shirt that is in medium size refers to t_shirt_size = 'Medium' | SELECT COUNT(T1.event_id) FROM event AS T1 INNER JOIN attendance AS T2 ON T1.event_id = T2.link_to_event INNER JOIN member AS T3 ON T2.link_to_member = T3.member_id WHERE T1.event_name = 'Women''s Soccer' AND T3.t_shirt_size = 'Medium' | student_club | null | null | null |
1322 | Among the events attended by more than 10 members of the Student_Club, how many of them are meetings? | meetings events refers to type = 'Meeting'; attended by more than 10 members refers to COUNT(event_id) > 10 | SELECT COUNT(*) FROM (SELECT T1.event_name FROM event AS T1 INNER JOIN attendance AS T2 ON T1.event_id = T2.link_to_event WHERE T1.type = 'Meeting' GROUP BY T1.event_id HAVING COUNT(T2.link_to_event) > 10) | student_club | null | null | null |
1323 | List all the names of events that had an attendance of over 20 students but were not fundraisers. | name of events refers to event_name; attendance of over 20 students COUNT(event_id) > 20. | SELECT DISTINCT E.`event_name`
FROM `Event` AS E
JOIN `Attendance` AS A ON E.`event_id` = A.`link_to_event`
WHERE E.`type` <> 'Fundraiser'
GROUP BY E.`event_id`
HAVING COUNT(*) > 20; | student_club | null | null | SELECT T1.event_name FROM event AS T1 INNER JOIN attendance AS T2 ON T1.event_id = T2.link_to_event GROUP BY T1.event_id HAVING COUNT(T2.link_to_event) > 20 EXCEPT SELECT T1.event_name FROM event AS T1 WHERE T1.type = 'Fundraiser' |
1331 | What is the amount of the funds that the Vice President received? | 'Vice President' is a position of Student Club; funds received refers to SUM(amount). | SELECT SUM(`Income`.`amount`) AS `amount_received`
FROM `Member`
JOIN `Income` ON `Member`.`member_id` = `Income`.`link_to_member`
WHERE `Member`.`position` = 'Vice President'; | student_club | null | 'Vice President' is a position of Student Club; funds received refers to amount. | SELECT T2.amount FROM member AS T1 INNER JOIN income AS T2 ON T1.member_id = T2.link_to_member WHERE T1.position = 'Vice President' |
1334 | List the full name of the Student_Club members that grew up in Illinois state. | full name of member refers to first_name, last_name | SELECT T1.first_name, T1.last_name FROM member AS T1 INNER JOIN zip_code AS T2 ON T1.zip = T2.zip_code WHERE T2.state = 'Illinois' | student_club | null | null | null |
1338 | Was each expense in October Meeting on October 8, 2019 approved? Output 'true' or 'false' for each expense. | event_name = 'October Meeting' where event_date = '2019-10-08'; approved = True means expenses was approved; approved = False means expenses was not approved | SELECT T3.approved FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event INNER JOIN expense AS T3 ON T2.budget_id = T3.link_to_budget WHERE T1.event_name = 'October Meeting' AND T1.event_date LIKE '2019-10-08%' | student_club | Was each expense in October Meeting on October 8, 2019 approved? 'true' or 'false' | null | null |
1339 | Calculate Elijah Allen’s average spend per event for events in September and October | Elijah Allen is the full name; full name refers to first_name, last_name; The 5th and 6th string of the expense_date in the expense table can refer to month; events in September and October refers to month(expense_date) = 9 OR month(expense_date) = 10 | SELECT SUM(T2.cost) / COUNT(DISTINCT link_to_budget)
FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member
WHERE T1.last_name = 'Allen' AND T1.first_name = 'Elijah'
AND (SUBSTR(T2.expense_date, 6, 2) = '09' OR SUBSTR(T2.expense_date, 6, 2) = '10') | student_club | Calculate the total average cost that Elijah Allen spent in the events on September and October. | null | SELECT AVG(T2.cost) FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T1.last_name = 'Allen' AND T1.first_name = 'Elijah' AND (SUBSTR(T2.expense_date, 6, 2) = '09' OR SUBSTR(T2.expense_date, 6, 2) = '10') |
1340 | Calculate the difference of the total amount spent in all events by the Student_Club in year 2019 and 2020. | The first 4 strings of the event_date values in the event table can represent year; The difference of the total amount spent = SUBTRACT(spent where YEAR(event_date) = 2019, spent where YEAR(event_date) = 2020) | SELECT SUM(CASE WHEN SUBSTR(T1.event_date, 1, 4) = '2019' THEN T2.spent ELSE 0 END) - SUM(CASE WHEN SUBSTR(T1.event_date, 1, 4) = '2020' THEN T2.spent ELSE 0 END) AS num FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event | student_club | null | null | null |
1344 | What was the notes of the fundraising on 2019/9/14? | fundraising on 2019/9/14 refers to source = 'Fundraising' where date_received = '2019-09-14' | SELECT notes FROM income WHERE source = 'Fundraising' AND date_received = '2019-09-14' | student_club | null | null | null |
1346 | Tell the phone number of "Carlo Jacobs". | Carlo Jacobs is the full name; full name refers to first_name, last_name; | SELECT phone FROM member WHERE first_name = 'Carlo' AND last_name = 'Jacobs' | student_club | null | null | null |
1350 | What is the status of the event which bought "Post Cards, Posters" on 2019/8/20? | 'Post Cards, Posters' is an expense description; on 2019/8/20 refers to expense_date = '2019-08-20'; status of event refers to event_status | SELECT T1.event_status FROM budget AS T1 INNER JOIN expense AS T2 ON T1.budget_id = T2.link_to_budget WHERE T2.expense_description = 'Post Cards, Posters' AND T2.expense_date = '2019-08-20' | student_club | null | 'Post Cards, Posters' is an expense description; on 2019/8/20 refers to expense_date = '2019-8-20'; status of event refers to event_status | null |
1351 | What was Brent Thomason's major? | Brent Thomason is the full name; full name refers to first_name, last_name; major refers to major_name | SELECT T2.major_name FROM member AS T1 INNER JOIN major AS T2 ON T1.link_to_major = T2.major_id WHERE T1.first_name = 'Brent' AND T1.last_name = 'Thomason' | student_club | null | null | null |
1352 | For all the club members from "Business" major, how many of them wear medium size t-shirt? | 'Business' is a major name; wear medium size t-shirt refers to t_shirt_size = 'Medium' | SELECT COUNT(T1.member_id) FROM member AS T1 INNER JOIN major AS T2 ON T1.link_to_major = T2.major_id WHERE T2.major_name = 'Business' AND T1.t_shirt_size = 'Medium' | student_club | null | null | null |
1356 | Which department was the President of the club in? | 'President' is a position of Student Club | SELECT T2.department FROM member AS T1 INNER JOIN major AS T2 ON T1.link_to_major = T2.major_id WHERE T1.position = 'President' | student_club | null | null | null |
1357 | State the date Connor Hilton paid his/her dues. | Connor Hilton is the full name; full name refers to first_name, last_name; date the dues was paid refers to date_received where source = 'Dues'; | SELECT T2.date_received FROM member AS T1 INNER JOIN income AS T2 ON T1.member_id = T2.link_to_member WHERE T1.first_name = 'Connor' AND T1.last_name = 'Hilton' AND T2.source = 'Dues' | student_club | null | null | null |
1359 | How many times was the budget in Advertisement for "Yearly Kickoff" meeting more than "October Meeting"? | budget in Advertisement refer to category = 'Advertisement' in the budget table; DIVIDE(SUM(amount when event_name = 'Yearly Kickoff'), SUM(amount when event_name = 'October Meeting')) | SELECT CAST(SUM(CASE WHEN T2.event_name = 'Yearly Kickoff' THEN T1.amount ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.event_name = 'October Meeting' THEN T1.amount ELSE 0 END) FROM budget AS T1 INNER JOIN event AS T2 ON T1.link_to_event = T2.event_id WHERE T1.category = 'Advertisement' AND T2.type = 'Meeting' | student_club | null | null | null |
1361 | What is the total cost of the pizzas for all the events? | total cost of the pizzas refers to SUM(cost) where expense_description = 'Pizza' | SELECT SUM(cost) FROM expense WHERE expense_description = 'Pizza' | student_club | null | null | null |
1362 | How many cities are there in Orange County, Virginia? | Orange County is the county name, Virginia is the state name | SELECT COUNT(distinct city) FROM zip_code WHERE county = 'Orange County' AND state = 'Virginia' | student_club | null | null | SELECT COUNT(city) FROM zip_code WHERE county = 'Orange County' AND state = 'Virginia' |
1368 | What does the person with the phone number "809-555-3360" major in? | major in refers to major_name | SELECT T2.major_name FROM member AS T1 INNER JOIN major AS T2 ON T1.link_to_major = T2.major_id WHERE T1.phone = '809-555-3360' | student_club | null | null | null |
1371 | How many members attended the "Women's Soccer" event? | 'Women's Soccer' is the event name; | SELECT COUNT(T2.link_to_member) FROM event AS T1 INNER JOIN attendance AS T2 ON T1.event_id = T2.link_to_event WHERE T1.event_name = 'Women''s Soccer' | student_club | null | null | null |
1375 | List all the members of the "School of Applied Sciences, Technology and Education" department. | list all members means to list all the full name; full name refers to first_name, last_name; | SELECT T1.first_name, T1.last_name FROM member AS T1 INNER JOIN major AS T2 ON T1.link_to_major = T2.major_id WHERE T2.department = 'School of Applied Sciences, Technology and Education' | student_club | null | null | null |
1376 | Among all the closed events, which event has the highest spend-to-budget ratio? | closed events refers to event_name where status = 'Closed'; highest spend-to budget ratio refers to MAX(DIVIDE(SUM(spent), SUM(amount))) | SELECT e.event_name FROM event AS e JOIN budget AS b ON e.event_id = b.link_to_event WHERE e.status = 'Closed' GROUP BY e.event_id, e.event_name HAVING SUM(b.amount) > 0 AND SUM(b.spent) / SUM(b.amount) = ( SELECT MAX(ratio) FROM ( SELECT SUM(b2.spent) * 1.0 / SUM(b2.amount) AS ratio FROM budget AS b2 JOIN event AS e2 ... | student_club | null | closed events refers to event_name where status = 'Closed'; highest spend-to budget ratio refers to MAX(DIVIDE(spent, amount)) | SELECT T2.event_name FROM budget AS T1 INNER JOIN event AS T2 ON T1.link_to_event = T2.event_id WHERE T2.status = 'Closed' ORDER BY T1.spent / T1.amount DESC LIMIT 1 |
1378 | What is the highest amount of budget spend for an event? | highest amount of budget spend refers to MAX(SUM(spent)) | SELECT MAX(total_spent) AS highest_event_spend
FROM (
SELECT SUM(`spent`) AS total_spent
FROM `Budget`
GROUP BY `link_to_event`
); | student_club | null | highest amount of budget spend refers to MAX(spent) | SELECT MAX(spent) FROM budget |
1380 | What is the total amount of money spent for food? | total amount of money spent refers to SUM(spent); spent for food refers to category = 'Food' | SELECT SUM(spent) FROM budget WHERE category = 'Food' | student_club | null | null | null |
1381 | List the name of students that have attended more than 7 events. | name of students means the full name; full name refers to first_name, last_name; attended more than 7 events refers to COUNT(link_to_event) > 7 | SELECT T1.first_name, T1.last_name FROM member AS T1 INNER JOIN attendance AS T2 ON T1.member_id = T2.link_to_member GROUP BY T2.link_to_member HAVING COUNT(T2.link_to_event) > 7 | student_club | null | null | null |
1387 | Which student has been entrusted to use the budget for the Yearly Kickoff? | name of students means the full name; full name refers to first_name, last_name;'Yearly Kickoff' is an event name; | SELECT T4.first_name, T4.last_name FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event INNER JOIN expense AS T3 ON T2.budget_id = T3.link_to_budget INNER JOIN member AS T4 ON T3.link_to_member = T4.member_id WHERE T1.event_name = 'Yearly Kickoff' | student_club | Which student has been entrusted to manage the budget for the Yearly Kickoff? | null | null |
1389 | Which event has the highest cost? Break ties by name in ascending alphabetical order. | event refers to event_name; highest cost means MAX(SUM(cost)) | SELECT e.event_name FROM event AS e JOIN budget AS b ON e.event_id = b.link_to_event JOIN expense AS ex ON b.budget_id = ex.link_to_budget GROUP BY e.event_id, e.event_name HAVING SUM(ex.cost) = (
SELECT MAX(total_cost) FROM ( SELECT SUM(ex2.cost) AS total_cost FROM event AS e2 JOIN budget AS b2 ON e2.event_id = b2.li... | student_club | Which event has the lowest cost? Break ties by name in alphabetical order. | event refers to event_name; lowest cost means MIN(cost) | SELECT T1.event_name FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event INNER JOIN expense AS T3 ON T2.budget_id = T3.link_to_budget ORDER BY T3.cost, T1.event_name LIMIT 1 |
1390 | Based on the total cost for all event, what is the percentage of cost for Yearly Kickoff event? | percentage = DIVIDE(SUM(cost where event_name = 'Yearly Kickoff'), SUM(cost)) * 100 | SELECT CAST(SUM(CASE WHEN T1.event_name = 'Yearly Kickoff' THEN T3.cost ELSE 0 END) AS REAL) * 100 / SUM(T3.cost) FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event INNER JOIN expense AS T3 ON T2.budget_id = T3.link_to_budget | student_club | null | null | null |
1392 | Indicate the top source of funds received in September 2019 based on their amount. | top source funds refers to MAX(SUM(source)); September 2019 means date_received BETWEEN '2019-09-01' and '2019-09-30' | SELECT `source`
FROM `Income`
WHERE `date_received` BETWEEN '2019-09-01' AND '2019-09-30'
GROUP BY `source`
ORDER BY SUM(`amount`) DESC
LIMIT 1; | student_club | null | top source funds refers to MAX(source); September 2019 means date_received BETWEEN '2019-09-01' and '2019-09-30' | SELECT source FROM income WHERE date_received BETWEEN '2019-09-01' and '2019-09-30' ORDER BY source DESC LIMIT 1 |
1394 | How many members of the Student_Club have major in 'Physics Teaching'? | 'Physics Teaching' is the major_name; | SELECT COUNT(T2.member_id) FROM major AS T1 INNER JOIN member AS T2 ON T1.major_id = T2.link_to_major WHERE T1.major_name = 'Physics Teaching' | student_club | null | null | null |
1398 | Name the event with the highest amount spent on advertisement. | Name of event refers to event_name; highest amount spent on advertisement refers to MAX(spent) where category = 'Advertisement' | SELECT T2.event_name FROM budget AS T1 INNER JOIN event AS T2 ON T1.link_to_event = T2.event_id WHERE T1.category = 'Advertisement' ORDER BY T1.spent DESC LIMIT 1 | student_club | null | null | null |
1399 | Did Maya Mclean attend the 'Women's Soccer' event? YES or NO. | Maya Mclean is the full name; full name refers to first_name, last_name; 'Women's Soccer' is an event_name | SELECT CASE WHEN COUNT(*) > 0 THEN 'YES' ELSE 'NO' END FROM member AS T1 INNER JOIN attendance AS T2 ON T1.member_id = T2.link_to_member INNER JOIN event AS T3 ON T2.link_to_event = T3.event_id WHERE T1.first_name = 'Maya' AND T1.last_name = 'Mclean' AND T3.event_name = 'Women''s Soccer' | student_club | null | null | null |
1401 | Indicate the cost of posters for 'September Speaker' event. | 'Posters' is the expense description; 'September Speaker' is an event name | SELECT T3.cost FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event INNER JOIN expense AS T3 ON T2.budget_id = T3.link_to_budget WHERE T1.event_name = 'September Speaker' AND T3.expense_description = 'Posters' | student_club | null | null | null |
1403 | Indicate the name of the closed event whose cost has exceeded the budget the most. | closed events refers to event_name where status = 'Closed'; exceed the budget the most refers to MIN(SUM(remaining)) where SUM(remaining) < 0 | SELECT e.`event_name`
FROM `Event` AS e
JOIN `Budget` AS b
ON b.`link_to_event` = e.`event_id`
WHERE e.`status` = 'Closed'
GROUP BY e.`event_id`
HAVING SUM(b.`remaining`) < 0
ORDER BY SUM(b.`remaining`)
LIMIT 1; | student_club | null | closed events refers to event_name where status = 'Closed'; exceed the budget the most refers to MIN(remaining) where remaining < 0 | SELECT T2.event_name FROM budget AS T1 INNER JOIN event AS T2 ON T2.event_id = T1.link_to_event WHERE T1.event_status = 'Closed' AND T1.remaining < 0 ORDER BY T1.remaining LIMIT 1 |
1404 | Identify the category of expenses and their total value approved for 'October Meeting' event. | total value refers to SUM(cost); 'October Meeting' is an event name; | SELECT
T2.`category`,
SUM(T3.`cost`) AS total_approved_value
FROM `event` AS T1
JOIN `budget` AS T2 ON T1.`event_id` = T2.`link_to_event`
JOIN `expense` AS T3 ON T2.`budget_id` = T3.`link_to_budget`
WHERE T1.`event_name` = 'October Meeting'
AND T3.`approved` = 'true'
GROUP BY T2.`category`; | student_club | null | null | SELECT T2.category, SUM(T3.cost) FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event INNER JOIN expense AS T3 ON T2.budget_id = T3.link_to_budget WHERE T1.event_name = 'October Meeting' GROUP BY T2.category |
1405 | List all the budgeted categories for the 'April Speaker' event, along with their amount budgeted. Return the results in an ascending order of their amount budgeted. | 'April Speaker' is an event name; amount budgeted refers to SUM(amount); budget categories refers to category | SELECT T2.category, SUM(T2.amount) FROM event AS T1 JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.event_name = 'April Speaker' GROUP BY T2.category ORDER BY SUM(T2.amount) ASC | student_club | List all the budgeted categories for the 'April Speaker' event in an ascending order, along with their amount budgeted. | null | null |
1409 | Mention the total expense used on 8/20/2019. | total expense refers SUM(cost) where expense_date = '2019-08-20' | SELECT SUM(cost) FROM expense WHERE expense_date = '2019-08-20' | student_club | null | null | null |
1410 | List out the full name and total cost that member id "rec4BLdZHS2Blfp4v" incurred? | full name refers to first_name, last name | SELECT T1.first_name, T1.last_name, SUM(T2.cost) FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T1.member_id = 'rec4BLdZHS2Blfp4v' | student_club | null | null | null |
1411 | State what kind of expenses that Sacha Harrison incurred? | kind of expenses refers to expense_description; Sacha Harrison is the full name; full name refers to first_name, last_name; | SELECT T2.expense_description FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T1.first_name = 'Sacha' AND T1.last_name = 'Harrison' | student_club | null | null | null |
1422 | State the category of events were held at MU 215. | 'MU 215' is the location of event; | SELECT `type`
FROM `event`
WHERE `location` = 'MU 215'; | student_club | null | null | SELECT DISTINCT T2.category FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.location = 'MU 215' |
1426 | List the last names of people whose position is member and whose major is environmental engineering, including their department and college names. | 'Environmental Engineering' is the major_name; position is member refers to position = 'Member' | SELECT T2.last_name, T1.department, T1.college FROM major AS T1 INNER JOIN member AS T2 ON T1.major_id = T2.link_to_major WHERE T2.position = 'Member' AND T1.major_name = 'Environmental Engineering' | student_club | List the last name of members with a major in environmental engineering and include its department and college name. | 'Environmental Engineering' is the major_name; | null |
1427 | What are the budget category of the events located at MU 215 and a guest speaker type with a 0 budget spent? | budget category refers to category; events located at refers to location; type = 'Guest Speaker'; 0 budget spent refers to spent = 0; | SELECT DISTINCT T2.category FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.location = 'MU 215' AND T2.spent = 0 AND T1.type = 'Guest Speaker' | student_club | null | null | null |
1432 | Among the members with t-shirt size of medium, what is the percentage of the amount 50 received by the Student_Club? | t_shirt_size = 'Medium' where position = 'Member'; percentage = DIVIDE(COUNT(amount = 50), COUNT(member_id)) * 100 | SELECT CAST(SUM(CASE WHEN T2.amount = 50 THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(T2.income_id) FROM member AS T1 INNER JOIN income AS T2 ON T1.member_id = T2.link_to_member WHERE T1.position = 'Member' AND T1.t_shirt_size = 'Medium' | student_club | null | null | null |
1435 | List the names of closed event as "game" that was closed from 3/15/2019 to 3/20/2020. | name of events refers event_name; game event that was closed refers to type = 'Game' where status = 'Closed'; event_date BETWEEN '2019-03-15' and '2020-03-20'; | SELECT DISTINCT event_name FROM event WHERE type = 'Game' AND date(SUBSTR(event_date, 1, 10)) BETWEEN '2019-03-15' AND '2020-03-20' AND status = 'Closed' | student_club | null | null | null |
1457 | Give the full name and contact number of members who had to spend more than average on each expense. | full name refers to first_name, last_name; contact number refers to phone; had spent more than average on each expense refers to cost > AVG(cost) | SELECT DISTINCT T3.first_name, T3.last_name, T3.phone FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id INNER JOIN member AS T3 ON T3.member_id = T1.link_to_member WHERE T1.cost > ( SELECT AVG(T1.cost) FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id INNER JOIN... | student_club | null | null | null |
1460 | Write the full name of the member who spent money for water, veggie tray and supplies and include the cost of it. | full name refers to first_name, last name; spent money for refers expense description; expense_description = 'Water, Veggie tray, supplies' | SELECT T2.first_name, T2.last_name, T1.cost FROM expense AS T1 INNER JOIN member AS T2 ON T1.link_to_member = T2.member_id WHERE T1.expense_description = 'Water, Veggie tray, supplies' | student_club | null | null | null |
1464 | Write the full names of students who received funds on the date of 9/9/2019 and include the amount received. | full name refers to first_name, last_name, amount of funds received refers to amount, received funds on date refers to date_received | SELECT M.`first_name`, M.`last_name`, I.`amount`
FROM `Income` I
JOIN `Member` M ON M.`member_id` = I.`link_to_member`
WHERE I.`date_received` = '2019-09-09'; | student_club | null | null | SELECT DISTINCT T3.first_name, T3.last_name, T4.amount FROM event AS T1 INNER JOIN attendance AS T2 ON T1.event_id = T2.link_to_event INNER JOIN member AS T3 ON T3.member_id = T2.link_to_member INNER JOIN income AS T4 ON T4.link_to_member = T3.member_id WHERE T4.date_received = '2019-09-09' |
1149 | Among male patients, what is the ratio of in-patients to outpatients? | male refers to SEX = 'M'; in-patient refers to Admission = '+'; outpatient refers to Admission = '-'; ratio = DIVIDE(COUNT(ID) where SEX = 'M' and Admission = '+', COUNT(ID) where SEX = 'M' and Admission = '-') | SELECT CAST(SUM(CASE WHEN Admission = '+' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN Admission = '-' THEN 1 ELSE 0 END) FROM Patient WHERE SEX = 'M' | thrombosis_prediction | Are there more in-patient or outpatient who were male? What is the deviation in percentage? | male refers to SEX = 'M'; in-patient refers to Admission = '+'; outpatient refers to Admission = '-'; percentage = DIVIDE(COUNT(ID) where SEX = 'M' and Admission = '+', COUNT(ID) where SEX = 'M' and Admission = '-') | null |
1150 | What is the percentage of female patient were born after 1930? | female refers to Sex = 'F'; patient who were born after 1930 refers to year(Birthday) > '1930'; calculation = DIVIDE(COUNT(ID) where year(Birthday) > '1930' and SEX = 'F'), (COUNT(ID) where SEX = 'F') | SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', Birthday) > '1930' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Patient WHERE SEX = 'F' | thrombosis_prediction | null | null | null |
1152 | What is the ratio of inpatient to outpatient followed up treatment among all the 'SLE' diagnosed patient? | 'SLE' diagnosed patient means Diagnosis = 'SLE'; inpatient refers to Admission = '+'; outpatient refers to Admission = '-'; calculation = DIVIDE(COUNT(ID) where Diagnosis = 'SLE' and Admission = '+', COUNT(ID) where Diagnosis = 'SLE' and Admission = '-') | SELECT SUM(CASE WHEN Admission = '+' THEN 1.0 ELSE 0 END) / SUM(CASE WHEN Admission = '-' THEN 1 ELSE 0 END) FROM Patient WHERE Diagnosis = 'SLE' | thrombosis_prediction | null | null | null |
1153 | What is the disease patient '30609' diagnosed with. List all the date of laboratory tests done for this patient. | '30609' is the Patient ID; disease means Diagnosis | SELECT T1.Diagnosis, T2.Date FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.ID = 30609 | thrombosis_prediction | null | null | null |
1155 | List the patient ID, sex and birthday of patient with LDH beyond normal range. | LDH beyond normal range refers to LDH >= '500'; | SELECT DISTINCT T1.ID, T1.SEX, T1.Birthday FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.LDH >= 500 | thrombosis_prediction | null | LDH beyond normal range refers to LDH > '500'; | SELECT DISTINCT T1.ID, T1.SEX, T1.Birthday FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.LDH > 500 |
1156 | State the ID and age of patient with positive degree of coagulation. | age refers to SUBTRACT(SUBTRACT(year(current_timestamp), year(Birthday)), MMDD(current_timestamp) < MMDD(Birthday)); positive degree of coagulation refers to RVVT = '+'; | SELECT DISTINCT T1.ID, STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.Birthday) - CASE
WHEN strftime('%m-%d','now') < strftime('%m-%d', Birthday) THEN 1
ELSE 0
END AS age FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.RVVT = '+' | thrombosis_prediction | null | age refers to SUBTRACT(year(current_timestamp), year(Birthday)); positive degree of coagulation refers to RVVT = '+'; | SELECT DISTINCT T1.ID, STRFTIME('%Y', CURRENT_TIMESTAMP) - STRFTIME('%Y', T1.Birthday) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.RVVT = '+' |
1157 | For patients with severe degree of thrombosis, list their ID, sex and disease the patient is diagnosed with. | severe degree of thrombosis refers to thrombosis = 2; disease refers to diagnosis; | SELECT DISTINCT T1.ID, T1.SEX, T1.Diagnosis FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.Thrombosis = 2 | thrombosis_prediction | null | null | null |
1162 | How many female patients who came at the hospital in 1997 was immediately followed at the outpatient clinic? | female refers to sex = 'F'; came at the hospital in 1997 refers to year(`First Date`) = '1997'; immediately followed at the outpatient clinic refers to Admission = '-' | SELECT COUNT(*)
FROM `Patient`
WHERE STRFTIME('%Y', `First Date`) = '1997'
AND `SEX` = 'F'
AND `Admission` = '-'; | thrombosis_prediction | null | female refers to sex = 'F'; came at the hospital in 1997 refers to year(Description) = '1997'; immediately followed at the outpatient clinic refers to Admission = '-' | SELECT COUNT(*) FROM Patient WHERE STRFTIME('%Y', Description) = '1997' AND SEX = 'F' AND Admission = '-' |
1164 | How many of the patients with the most serious thrombosis cases examined in 1997 are women? | the most serious thrombosis refers to Thrombosis = '1' (the most severe one); women refers to sex = 'F' | SELECT COUNT(DISTINCT T1.ID)
FROM `Patient` AS T1
JOIN `Examination` AS T2 ON T1.ID = T2.ID
WHERE T1.`SEX` = 'F'
AND STRFTIME('%Y', T2.`Examination Date`) = '1997'
AND T2.`Thrombosis` = 1; | thrombosis_prediction | null | null | SELECT COUNT(*) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T1.SEX = 'F' AND STRFTIME('%Y', T2."Examination Date") = '1997' AND T2.Thrombosis = 1 |
1166 | What are the symptoms observed by the youngest patient to ever did a medical examination? Identify the patient diagnosis. | The larger the birthday value, the younger the person is, and vice versa; patient diagnosis refers to patient.diagnosis | SELECT DISTINCT e.Symptoms, p.Diagnosis FROM Patient AS p INNER JOIN Examination AS e ON p.ID = e.ID WHERE p.Birthday = ( SELECT MAX(p2.Birthday) FROM Patient AS p2 INNER JOIN Examination AS e2 ON p2.ID = e2.ID ) AND NOT e.Symptoms IS NULL UNION SELECT NULL AS Symptoms, p.Diagnosis FROM Patient AS p WHERE p.ID = (SELEC... | thrombosis_prediction | null | The larger the birthday value, the younger the person is, and vice versa; symptoms observed refers to the symptoms is not NULL | SELECT T2.Symptoms, T1.Diagnosis FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE T2.Symptoms IS NOT NULL ORDER BY T1.Birthday DESC LIMIT 1 |
1168 | For the oldest SJS patient, on what date was their medical laboratory work last completed, and what age was the patient when they initially arrived at the hospital? | The larger the birthday value, the younger the person is, and vice versa; 'SJS' refers to Patient.Diagnosis = 'SJS'; age of the patients when they initially arrived at the hospital refers to SUBTRACT(SUBTRACT(year(`First Date`), year(Birthday)), MMDD(`First Date`) < MMDD(Birthday)); | SELECT T1.Date, STRFTIME('%Y', "First Date") - STRFTIME('%Y', Birthday) - CASE
WHEN strftime('%m-%d',"First Date") < strftime('%m-%d', Birthday) THEN 1
ELSE 0
END AS age
FROM Laboratory AS T1 INNER JOIN Patient AS T2 ON T1.ID = T2.ID WHERE T2.Diagnosis = 'SJS' AND T2.Birthday IS NOT NULL ORDER BY T2.Birthday ... | thrombosis_prediction | null | The larger the birthday value, the younger the person is, and vice versa; 'SJS' refers to Patient.Diagnosis; (SUBTRACT(year(`First Date`)), year(Birthday)); age of the patients when they initially arrived at the hospital refers to year(Birthday) | SELECT T1.Date, STRFTIME('%Y', T2."First Date") - STRFTIME('%Y', T2.Birthday) FROM Laboratory AS T1 INNER JOIN Patient AS T2 ON T1.ID = T2.ID WHERE T2.Diagnosis = 'SJS' AND T2.Birthday IS NOT NULL ORDER BY T2.Birthday ASC, T1.Date DESC LIMIT 1 |
1169 | What is the ratio of male to female patients among all those with abnormal uric acid counts? | male refers to SEX = 'M'; female refers to SEX = 'F'; abnormal uric acid refers to UA < = '8.0' where SEX = 'M', UA < = '6.5' where SEX = 'F'; calculation = DIVIDE(SUM(UA <= '8.0' and SEX = 'M'), SUM(UA <= '6.5 and SEX = 'F')) | SELECT CAST(COUNT(DISTINCT CASE WHEN T2.UA <= 8.0 AND T1.SEX = 'M' THEN T1.ID ELSE NULL END) AS REAL) / COUNT(DISTINCT CASE WHEN T2.UA <= 6.5 AND T1.SEX = 'F' THEN T1.ID ELSE NULL END) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID | thrombosis_prediction | null | null | null |
1171 | How many patients were under age when examined during the course of the four-year period from 1990 to 1993? | underage patients refers to ADD(Birthday, 18 years) > "Examination Date"; four-year period from 1990 to 1993 refers to year("Examination Date") between '1990' and '1993' | SELECT COUNT(T1.ID)
FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID
WHERE STRFTIME('%Y', T2."Examination Date") BETWEEN '1990' AND '1993' AND date(Birthday, '+18 years') > date(T2."Examination Date") | thrombosis_prediction | How many patients were under age when examined during the course of the three-year period from 1990 to 1993? | underage patients refers to year("Examination Date") - year(Birthday) < 18; three-year period from 1990 to 1993 refers to year("Examination Date") between '1990' and '1993' | SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Examination AS T2 ON T1.ID = T2.ID WHERE STRFTIME('%Y', T2."Examination Date") BETWEEN '1990' AND '1993' AND STRFTIME('%Y', T2."Examination Date") - STRFTIME('%Y', T1.Birthday) < 18 |
1175 | How old was the patient who had the highest hemoglobin count at the time of the laboratory test, and what is the doctor's diagnosis? | How old the patient refers to SUBTRACT(SUBTRACT(year(`Date`), year(Birthday)), MMDD(`Date`) < MMDD(Birthday)); the highest hemoglobin count refers to MAX(HGB); doctor's diagnosis refers to Patient.diagnosis | SELECT STRFTIME('%Y', T2.Date) - STRFTIME('%Y', T1.Birthday) - CASE
WHEN strftime('%m-%d',T2.Date) < strftime('%m-%d', Birthday) THEN 1
ELSE 0
END AS age ,T1.Diagnosis FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID ORDER BY T2.HGB DESC LIMIT 1 | thrombosis_prediction | How old was the patient who had the highest hemoglobin count at the time of the examination, and what is the doctor's diagnosis? | How old the patient refers to SUBTRACT(year("Examination Date"), year(Birthday)); the highest hemoglobin count refers to MAX(HGB) | SELECT STRFTIME('%Y', T2.Date) - STRFTIME('%Y', T1.Birthday), T1.Diagnosis FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID ORDER BY T2.HGB DESC LIMIT 1 |
1179 | For the patient who was diagnosed with SLE on 1994/2/19, what was his/her anti-Cardiolipin antibody (IgM) concentration status on 1993/11/12? | diagnosed with SLE refers to Diagnosis = 'SLE'; 1994/2/19 refers to Description = '1994-02-19'; anti-Cardiolipin antibody (IgM) refers to aCL IgM; 1993/11/12 refers to Examination Date = '1993/11/12' | SELECT "aCL IgM" FROM Examination WHERE ID IN (SELECT ID FROM Patient WHERE Diagnosis = 'SLE' AND Description = '1994-02-19') AND "Examination Date" = '1993-11-12' | thrombosis_prediction | For the patient who was diagnosed with SLE on 1994/2/19, what was his/her anti-Cardiolipin antibody concentration status on 1993/11/12? | diagnosed with SLE refers to Diagnosis = 'SLE'; 1994/2/19 refers to Description = '1994-02-19'; anti-Cardiolipin refers to aCL IgM; 1993/11/12 refers to Examination Date = '1993/11/12' | null |
1185 | For the patient who was born on 1959/2/18, what is the decrease rate for his/her total cholesterol from November to December in 1981? | born on 1959/2/18 refers to Birthday = '1959-02-18'; calculation = DIVISION(SUBTRACT(SUM(Birthday = '1959-02-18' and Date like '1981-11-%' THEN `T-CHO`), SUM(Birthday = '1959-02-18' and Date like '1981-12-%' THEN `T-CHO`)), SUM(Birthday = '1959-02-18' and Date like '1981-11-%' THEN `T-CHO`)) | SELECT CAST((SUM(CASE WHEN T2.Date LIKE '1981-11-%' THEN T2."T-CHO" ELSE 0 END) - SUM(CASE WHEN T2.Date LIKE '1981-12-%' THEN T2."T-CHO" ELSE 0 END)) AS REAL) / SUM(CASE WHEN T2.Date LIKE '1981-11-%' THEN T2."T-CHO" ELSE 0 END) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.Birthday = '1959-02... | thrombosis_prediction | null | null | null |
1187 | List the IDs of patients who were examined between 1987/7/6 and 1996/1/31 had a GPT level greater than 30 and an ALB level less than 4. | examined between 1987/7/6 and 1996/1/31 refers to Date BETWEEN '1987-07-06' AND '1996-01-31'; GPT level greater than 30 refers to GPT > 30; ALB level less than 4 ALB < 4 | SELECT DISTINCT ID FROM Laboratory WHERE Date BETWEEN '1987-07-06' AND '1996-01-31' AND GPT > 30 AND ALB < 4 | thrombosis_prediction | How many patients who were examined between 1987/7/6 and 1996/1/31 had a GPT level greater than 30 and an ALB level less than 4? List them by their ID. | null | null |
1189 | What number of patients with a degree of thrombosis level 2 and ANA pattern of only S, have a level of anti-Cardiolip in antibody (IgM) 20% higher than average value of that same subgroup? | thrombosis level 2 refers to Thrombosis = 2; ANA pattern of only S refers to ANA = 'S'; average anti-Cardiolip in antibody (IgM) refers to AVG("aCL IgM"); | SELECT COUNT(DISTINCT `ID`)
FROM `Examination`
WHERE `Thrombosis` = 2
AND `ANA Pattern` = 'S'
AND `aCL IgM` > (SELECT AVG(`aCL IgM`) * 1.20 FROM `Examination` WHERE `Thrombosis` = 2
AND `ANA Pattern` = 'S'); | thrombosis_prediction | What number of patients with a degree of thrombosis level 2 and ANA pattern of only S, have a level of anti-Cardiolip in antibody (IgM) 20% higher than average? | thrombosis level 2 refers to Thrombosis = 2; ANA pattern of only S refers to ANA = 'S'; average anti-Cardiolip in antibody (IgM) refers to AVG("aCL IgM"); calculation = MULTIPLY(AVG + AVG, 0.2) | SELECT COUNT(*) FROM Examination WHERE Thrombosis = 2 AND "ANA Pattern" = 'S' AND "aCL IgM" > (SELECT AVG("aCL IgM") * 1.2 FROM Examination WHERE Thrombosis = 2 AND "ANA Pattern" = 'S') |
1192 | List all patients who were followed up at the outpatient clinic who underwent a laboratory test in October 1991 and had a total blood bilirubin level within the normal range. | followed up at the outpatient clinic refers to Admission = '-'; laboratory test in April 1981 refers to Date like '1991-10%'; blood bilirubin level within the normal range refers to T-BIL < 2.0; | SELECT DISTINCT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.Admission = '-' AND T2."T-BIL" < 2.0 AND T2.Date LIKE '1991-10-%' | thrombosis_prediction | null | null | null |
1195 | What is the average blood albumin level across all lab records for female patients diagnosed with SLE in records where PLT > 400? | average blood albumin level refers to AVG(ALB); female refers to SEX = 'F'; PLT greater than 400 refers to PLT > 400; diagnosed with SLE refers to Diagnosis= 'SLE' | SELECT AVG(T2.ALB) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.PLT > 400 AND T1.Diagnosis = 'SLE' AND T1.SEX = 'F' | thrombosis_prediction | What is the average blood albumin level for female patients with a PLT greater than 400 who have been diagnosed with SLE? | null | null |
1198 | How many female patients were given an APS diagnosis? | female refers to SEX = 'F'; APS diagnosis refers to Patient.Diagnosis='APS' | SELECT COUNT(ID) FROM Patient WHERE SEX = 'F' AND Diagnosis = 'APS' | thrombosis_prediction | null | null | null |
1201 | What percentage of patients who were born in 1980 and were diagnosed with RA are women? | born in 1980 refers to YEAR(BIRTHDAY) = '1980'; 'RA' refers to Patient.Diagnosis='RA' ; women refers to SEX = 'F'; calculation = DIVIDE(SUM(SEX = 'F'), COUNT(SEX)) * 100 | SELECT CAST(SUM(CASE WHEN SEX = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(ID) FROM Patient WHERE Diagnosis = 'RA' AND STRFTIME('%Y', Birthday) = '1980' | thrombosis_prediction | null | null | null |
Corrected Arcwise-Plat Text-to-SQL evaluation datasets.
full: questions, evidence, and gold SQL may be corrected.sql_only: only gold SQL is corrected; questions and evidence remain unchanged.Each configuration contains 498 test examples with unique question_id values.
| Field | Type | Required | Description |
|---|---|---|---|
question_id |
string | yes | Question identifier, unique within each configuration |
question |
string | yes | Natural-language question |
evidence |
nullable string | yes | External knowledge or evidence |
SQL |
string | yes | Corrected gold SQL |
db_id |
string | yes | Database identifier |
original_SQL |
string | no | Original SQL when corrected |
original_question |
string | no | Original question when corrected (full only) |
original_evidence |
string | no | Original evidence when corrected (full only) |
The evidence field is null for question IDs 1507 and 1528.
The benchmark data is maintained in the Text-to-SQL Benchmarks repository.