Text2SQL
Collection
15 items
•
Updated
difficulty
stringclasses 3
values | SQL
stringlengths 35
1.58k
| question
stringlengths 23
286
| question_id
int64 5
1.53k
| db_id
stringclasses 11
values | evidence
stringlengths 0
468
|
---|---|---|---|---|---|
simple | SELECT CAST(SUM(CASE WHEN `Currency` = 'EUR' THEN 1 ELSE 0 END) AS DOUBLE) / SUM(CASE WHEN `Currency` = 'CZK' THEN 1 ELSE 0 END) FROM `customers` | What is the ratio of customers who pay in EUR against customers who pay in CZK? | 1,471 | debit_card_specializing | ratio of customers who pay in EUR against customers who pay in CZK = count(Currency = 'EUR') / count(Currency = 'CZK'). |
moderate | 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 | In 2012, who had the least consumption in LAM? | 1,472 | debit_card_specializing | 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. |
moderate | SELECT
AVG(`T2`.`Consumption`) / 12
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' | What was the average monthly consumption of customers in SME for the year 2013? | 1,473 | debit_card_specializing | Average Monthly consumption = AVG(Consumption) / 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. |
challenging | SELECT
SUM(CASE WHEN `T1`.`Currency` = 'CZK' THEN `T2`.`Consumption` ELSE 0 END) - SUM(CASE WHEN `T1`.`Currency` = 'EUR' THEN `T2`.`Consumption` ELSE 0 END)
FROM `customers` AS `T1`
INNER JOIN `yearmonth` AS `T2`
ON `T1`.`CustomerID` = `T2`.`CustomerID`
WHERE
SUBSTR(`T2`.`Date`, 1, 4) = '2012' | What was the difference in gas consumption between CZK-paying customers and EUR-paying customers in 2012? | 1,476 | debit_card_specializing | 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 |
moderate | 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 | Which year recorded the most consumption of gas paid in CZK? | 1,479 | debit_card_specializing | The first 4 strings of the Date values in the yearmonth table can represent year. |
moderate | 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 | What was the gas consumption peak month for SME customers in 2013? | 1,480 | debit_card_specializing | 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. |
challenging | SELECT
CAST(SUM(CASE WHEN `T1`.`Segment` = 'SME' THEN `T2`.`Consumption` ELSE 0 END) AS DOUBLE) / COUNT(`T1`.`CustomerID`) - CAST(SUM(CASE WHEN `T1`.`Segment` = 'LAM' THEN `T2`.`Consumption` ELSE 0 END) AS DOUBLE) / COUNT(`T1`.`CustomerID`),
CAST(SUM(CASE WHEN `T1`.`Segment` = 'LAM' THEN `T2`.`Consumption` ELSE 0 END) AS DOUBLE) / COUNT(`T1`.`CustomerID`) - CAST(SUM(CASE WHEN `T1`.`Segment` = 'KAM' THEN `T2`.`Consumption` ELSE 0 END) AS DOUBLE) / COUNT(`T1`.`CustomerID`),
CAST(SUM(CASE WHEN `T1`.`Segment` = 'KAM' THEN `T2`.`Consumption` ELSE 0 END) AS DOUBLE) / COUNT(`T1`.`CustomerID`) - CAST(SUM(CASE WHEN `T1`.`Segment` = 'SME' THEN `T2`.`Consumption` ELSE 0 END) AS DOUBLE) / COUNT(`T1`.`CustomerID`)
FROM `customers` AS `T1`
INNER JOIN `yearmonth` AS `T2`
ON `T1`.`CustomerID` = `T2`.`CustomerID`
WHERE
`T1`.`Currency` = 'CZK'
AND `T2`.`Consumption` = (
SELECT
MIN(`Consumption`)
FROM `yearmonth`
)
AND `T2`.`Date` BETWEEN 201301 AND 201312 | 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? | 1,481 | debit_card_specializing | 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 average; 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. |
challenging | SELECT
CAST((
SUM(
CASE
WHEN `T1`.`Segment` = 'SME' AND `T2`.`Date` LIKE '2013%'
THEN `T2`.`Consumption`
ELSE 0
END
) - SUM(
CASE
WHEN `T1`.`Segment` = 'SME' AND `T2`.`Date` LIKE '2012%'
THEN `T2`.`Consumption`
ELSE 0
END
)
) AS DOUBLE) * 100 / SUM(
CASE
WHEN `T1`.`Segment` = 'SME' AND `T2`.`Date` LIKE '2012%'
THEN `T2`.`Consumption`
ELSE 0
END
),
CAST(SUM(
CASE
WHEN `T1`.`Segment` = 'LAM' AND `T2`.`Date` LIKE '2013%'
THEN `T2`.`Consumption`
ELSE 0
END
) - SUM(
CASE
WHEN `T1`.`Segment` = 'LAM' AND `T2`.`Date` LIKE '2012%'
THEN `T2`.`Consumption`
ELSE 0
END
) AS DOUBLE) * 100 / SUM(
CASE
WHEN `T1`.`Segment` = 'LAM' AND `T2`.`Date` LIKE '2012%'
THEN `T2`.`Consumption`
ELSE 0
END
),
CAST(SUM(
CASE
WHEN `T1`.`Segment` = 'KAM' AND `T2`.`Date` LIKE '2013%'
THEN `T2`.`Consumption`
ELSE 0
END
) - SUM(
CASE
WHEN `T1`.`Segment` = 'KAM' AND `T2`.`Date` LIKE '2012%'
THEN `T2`.`Consumption`
ELSE 0
END
) AS DOUBLE) * 100 / SUM(
CASE
WHEN `T1`.`Segment` = 'KAM' AND `T2`.`Date` LIKE '2012%'
THEN `T2`.`Consumption`
ELSE 0
END
)
FROM `customers` AS `T1`
INNER JOIN `yearmonth` AS `T2`
ON `T1`.`CustomerID` = `T2`.`CustomerID` | Which of the three segments—SME, LAM and KAM—has the biggest and lowest percentage increases in consumption paid in EUR between 2012 and 2013? | 1,482 | debit_card_specializing | Increase or Decrease = consumption for 2013 - consumption for 2012; Percentage of Increase = (Increase or Decrease / consumption for 2013) * 100%; The first 4 strings of the Date values in the yearmonth table can represent year |
simple | SELECT
SUM(`Consumption`)
FROM `yearmonth`
WHERE
`CustomerID` = 6 AND `Date` BETWEEN '201308' AND '201311' | How much did customer 6 consume in total between August and November 2013? | 1,483 | debit_card_specializing | 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. |
simple | SELECT
SUM(CASE WHEN `Country` = 'CZE' THEN 1 ELSE 0 END) - SUM(CASE WHEN `Country` = 'SVK' THEN 1 ELSE 0 END)
FROM `gasstations`
WHERE
`Segment` = 'Discount' | How many more "discount" gas stations does the Czech Republic have compared to Slovakia? | 1,484 | debit_card_specializing | 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 |
simple | SELECT
SUM(`Currency` = 'CZK') - SUM(`Currency` = 'EUR')
FROM `customers`
WHERE
`Segment` = 'SME' | Is it true that more SMEs pay in Czech koruna than in euros? If so, how many more? | 1,486 | debit_card_specializing | Amount of more SMEs = Total of SMEs pay using Currency CZK - Total of SMEs pay using Currency EUR |
moderate | SELECT
CAST(SUM(CASE WHEN `T2`.`Consumption` > 46.73 THEN 1 ELSE 0 END) AS DOUBLE) * 100 / COUNT(`T1`.`CustomerID`)
FROM `customers` AS `T1`
INNER JOIN `yearmonth` AS `T2`
ON `T1`.`CustomerID` = `T2`.`CustomerID`
WHERE
`T1`.`Segment` = 'LAM' | How many percent of LAM customer consumed more than 46.73? | 1,490 | debit_card_specializing | 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. |
simple | SELECT
CAST(SUM(CASE WHEN `Consumption` > 528.3 THEN 1 ELSE 0 END) AS DOUBLE) * 100 / COUNT(`CustomerID`)
FROM `yearmonth`
WHERE
`Date` = '201202' | In February 2012, what percentage of customers consumed more than 528.3? | 1,493 | debit_card_specializing | 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. |
simple | SELECT
SUM(`Consumption`)
FROM `yearmonth`
WHERE
SUBSTR(`Date`, 1, 4) = '2012'
GROUP BY
SUBSTR(`Date`, 5, 2)
ORDER BY
SUM(`Consumption`) DESC
LIMIT 1 | What is the highest monthly consumption in the year 2012? | 1,498 | debit_card_specializing | 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. |
simple | SELECT
`T3`.`Description`
FROM `transactions_1k` AS `T1`
INNER JOIN `yearmonth` AS `T2`
ON `T1`.`CustomerID` = `T2`.`CustomerID`
INNER JOIN `products` AS `T3`
ON `T1`.`ProductID` = `T3`.`ProductID`
WHERE
`T2`.`Date` = '201309' | Please list the product description of the products consumed in September, 2013. | 1,500 | debit_card_specializing | September 2013 refers to 201309; 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. |
moderate | SELECT DISTINCT
`T2`.`Country`
FROM `transactions_1k` AS `T1`
INNER JOIN `gasstations` AS `T2`
ON `T1`.`GasStationID` = `T2`.`GasStationID`
INNER JOIN `yearmonth` AS `T3`
ON `T1`.`CustomerID` = `T3`.`CustomerID`
WHERE
`T3`.`Date` = '201306' | Please list the countries of the gas stations with transactions taken place in June, 2013. | 1,501 | debit_card_specializing | June 2013 refers to '201306'; 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; |
simple | SELECT
COUNT(*)
FROM `yearmonth` AS `T1`
INNER JOIN `customers` AS `T2`
ON `T1`.`CustomerID` = `T2`.`CustomerID`
WHERE
`T2`.`Currency` = 'EUR' AND `T1`.`Consumption` > 1000.00 | Among the customers who paid in euro, how many of them have a monthly consumption of over 1000? | 1,505 | debit_card_specializing | Pays in euro = Currency = 'EUR'. |
moderate | 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' | Please list the product descriptions of the transactions taken place in the gas stations in the Czech Republic. | 1,506 | debit_card_specializing | Czech Republic can be represented as the Country value in the gasstations table is 'CZE'; |
simple | SELECT DISTINCT
`T1`.`Time`
FROM `transactions_1k` AS `T1`
INNER JOIN `gasstations` AS `T2`
ON `T1`.`GasStationID` = `T2`.`GasStationID`
WHERE
`T2`.`ChainID` = 11 | Please list the disparate time of the transactions taken place in the gas stations from chain no. 11. | 1,507 | debit_card_specializing | |
moderate | SELECT
COUNT(`T1`.`TransactionID`)
FROM `transactions_1k` AS `T1`
INNER JOIN `gasstations` AS `T2`
ON `T1`.`GasStationID` = `T2`.`GasStationID`
WHERE
`T2`.`Country` = 'CZE'
AND DATE_FORMAT(CAST(`T1`.`Date` AS DATETIME), '%Y') >= '2012' | Among the transactions made in the gas stations in the Czech Republic, how many of them are taken place after 2012/1/1? | 1,509 | debit_card_specializing | Czech Republic can be represented as the Country value in the gasstations table is 'CZE' |
simple | 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' | What kind of currency did the customer paid at 16:25:00 in 2012/8/24? | 1,514 | debit_card_specializing | '2012/8/24' can be represented by '2012-08-24'; |
simple | 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' | What segment did the customer have at 2012/8/23 21:20:00? | 1,515 | debit_card_specializing | '2012/8/23' can be represented by '2012-08-23' |
moderate | 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' | For all the transactions happened during 8:00-9:00 in 2012/8/26, how many happened in CZE? | 1,521 | debit_card_specializing | 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' |
simple | 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 | What's the nationality of the customer who spent 548.4 in 2012/8/24? | 1,524 | debit_card_specializing | '2012/8/24' can be represented by '2012-08-24' |
simple | SELECT
CAST(SUM(CASE WHEN `T2`.`Currency` = 'EUR' THEN 1 ELSE 0 END) AS DOUBLE) * 100 / COUNT(`T1`.`CustomerID`)
FROM `transactions_1k` AS `T1`
INNER JOIN `customers` AS `T2`
ON `T1`.`CustomerID` = `T2`.`CustomerID`
WHERE
`T1`.`Date` = '2012-08-25' | What is the percentage of the customers who used EUR in 2012/8/25? | 1,525 | debit_card_specializing | '2012/8/25' can be represented by '2012-08-25' |
challenging | SELECT
CAST(SUM(CASE WHEN SUBSTR(`Date`, 1, 4) = '2012' THEN `Consumption` ELSE 0 END) - SUM(CASE WHEN SUBSTR(`Date`, 1, 4) = '2013' THEN `Consumption` ELSE 0 END) AS DOUBLE) / SUM(CASE WHEN SUBSTR(`Date`, 1, 4) = '2012' THEN `Consumption` ELSE 0 END)
FROM `yearmonth`
WHERE
`CustomerID` = (
SELECT
`T1`.`CustomerID`
FROM `transactions_1k` AS `T1`
INNER JOIN `gasstations` AS `T2`
ON `T1`.`GasStationID` = `T2`.`GasStationID`
WHERE
`T1`.`Date` = '2012-08-25' AND `T1`.`Price` = 1513.12 ) | For the customer who paid 634.8 in 2012/8/25, what was the consumption decrease rate from Year 2012 to 2013? | 1,526 | debit_card_specializing | '2012/8/24' can be represented by '2012-08-24'; Consumption decrease rate = (consumption_2012 - consumption_2013) / consumption_2012 |
simple | SELECT
CAST(SUM(CASE WHEN `Country` = 'SVK' AND `Segment` = 'Premium' THEN 1 ELSE 0 END) AS DOUBLE) * 100 / SUM(CASE WHEN `Country` = 'SVK' THEN 1 ELSE 0 END)
FROM `gasstations` | What is the percentage of "premium" against the overall segment in Country = "SVK"? | 1,528 | debit_card_specializing | |
moderate | SELECT
SUM(`T1`.`Price` ),
SUM(CASE WHEN `T3`.`Date` = '201201' THEN `T1`.`Price` ELSE 0 END)
FROM `transactions_1k` AS `T1`
INNER JOIN `gasstations` AS `T2`
ON `T1`.`GasStationID` = `T2`.`GasStationID`
INNER JOIN `yearmonth` AS `T3`
ON `T1`.`CustomerID` = `T3`.`CustomerID`
WHERE
`T1`.`CustomerID` = '38508' | What is the amount spent by customer "38508" at the gas stations? How much had the customer spent in January 2012? | 1,529 | debit_card_specializing | January 2012 refers to the Date value = '201201' |
moderate | SELECT
`T2`.`CustomerID`,
SUM(`T2`.`Price` / `T2`.`Amount`),
`T1`.`Currency`
FROM `customers` AS `T1`
INNER JOIN `transactions_1k` AS `T2`
ON `T1`.`CustomerID` = `T2`.`CustomerID`
WHERE
`T2`.`CustomerID` = (
SELECT
`CustomerID`
FROM `yearmonth`
ORDER BY
`Consumption` DESC
LIMIT 1
)
GROUP BY
`T2`.`CustomerID`,
`T1`.`Currency` | 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? | 1,531 | debit_card_specializing | average price per single item = Total(price) / Total(amount) |
moderate | 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' | 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. | 1,533 | debit_card_specializing | August of 2012 refers to the Date value = '201208' ; Price per unit of product = Price / Amount; |
simple | 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' | What's Angela Sanders's major? | 1,312 | student_club | Angela Sanders is the full name; full name refers to first_name, last_name; major refers to major_name. |
moderate | 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' | 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? | 1,317 | student_club | Women's Soccer is an event name; T-shirt that is in medium size refers to t_shirt_size = 'Medium' |
moderate | 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`) > 10
EXCEPT
SELECT
`T1`.`event_name`
FROM `event` AS `T1`
WHERE
`T1`.`type` = 'Meeting' | Among the events attended by more than 10 members of the Student_Club, how many of them are meetings? | 1,322 | student_club | meetings events refers to type = 'Meeting'; attended by more than 10 members refers to COUNT(event_id) > 10 |
moderate | 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 AND NOT EXISTS (SELECT 1 FROM `event` AS `E` WHERE `E`.`event_id` = `T1`.`event_id` AND `E`.`type` = 'Fundraiser') | List all the names of events that had an attendance of over 20 students but were not fundraisers. | 1,323 | student_club | name of events refers to event_name; attendance of over 20 students COUNT(event_id) > 20. |
simple | 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' | What is the amount of the funds that the Vice President received? | 1,331 | student_club | 'Vice President' is a position of Student Club; funds received refers to amount. |
simple | 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' | List the full name of the Student_Club members that grew up in Illinois state. | 1,334 | student_club | full name of member refers to first_name, last_name |
moderate | 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%' | Was each expense in October Meeting on October 8, 2019 approved? | 1,338 | student_club | event_name = 'October Meeting' where event_date = '2019-10-08'; approved = True means expenses was approved; approved = False means expenses was not approved |
challenging | 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'
) | Calculate the total average cost that Elijah Allen spent in the events on September and October. | 1,339 | student_club | 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 |
moderate | 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` | Calculate the difference of the total amount spent in all events by the Student_Club in year 2019 and 2020. | 1,340 | student_club | 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) |
simple | SELECT
`notes`
FROM `income`
WHERE
`source` = 'Fundraising' AND `date_received` = '2019-09-14' | What was the notes of the fundraising on 2019/9/14? | 1,344 | student_club | fundraising on 2019/9/14 refers to source = 'Fundraising' where date_received = '2019-09-14' |
simple | SELECT
`phone`
FROM `member`
WHERE
`first_name` = 'Carlo' AND `last_name` = 'Jacobs' | Tell the phone number of "Carlo Jacobs". | 1,346 | student_club | Carlo Jacobs is the full name; full name refers to first_name, last_name; |
moderate | 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' | What is the status of the event which bought "Post Cards, Posters" on 2019/8/20? | 1,350 | student_club | '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 |
simple | 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' | What was Brent Thomason's major? | 1,351 | student_club | Brent Thomason is the full name; full name refers to first_name, last_name; major refers to major_name |
moderate | 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' | For all the club members from "Business" major, how many of them wear medium size t-shirt? | 1,352 | student_club | 'Business' is a major name; wear medium size t-shirt refers to t_shirt_size = 'Medium' |
simple | SELECT
`T2`.`department`
FROM `member` AS `T1`
INNER JOIN `major` AS `T2`
ON `T1`.`link_to_major` = `T2`.`major_id`
WHERE
`T1`.`position` = 'President' | Which department was the President of the club in? | 1,356 | student_club | 'President' is a position of Student Club |
simple | 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' | State the date Connor Hilton paid his/her dues. | 1,357 | student_club | 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'; |
challenging | SELECT
CAST(SUM(CASE WHEN `T2`.`event_name` = 'Yearly Kickoff' THEN `T1`.`amount` ELSE 0 END) AS DOUBLE) / 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' | How many times was the budget in Advertisement for "Yearly Kickoff" meeting more than "October Meeting"? | 1,359 | student_club | 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')) |
simple | SELECT
SUM(`cost`)
FROM `expense`
WHERE
`expense_description` = 'Pizza' | What is the total cost of the pizzas for all the events? | 1,361 | student_club | total cost of the pizzas refers to SUM(cost) where expense_description = 'Pizza' |
simple | SELECT
COUNT(`city`)
FROM `zip_code`
WHERE
`county` = 'Orange County' AND `state` = 'Virginia' | How many cities are there in Orange County, Virginia? | 1,362 | student_club | Orange County is the county name, Virginia is the state name |
simple | 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' | What does the person with the phone number "809-555-3360" major in? | 1,368 | student_club | major in refers to major_name |
simple | 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' | How many members attended the "Women's Soccer" event? | 1,371 | student_club | 'Women's Soccer' is the event name; |
moderate | 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' | List all the members of the "School of Applied Sciences, Technology and Education" department. | 1,375 | student_club | list all members means to list all the full name; full name refers to first_name, last_name; |
moderate | 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 | Among all the closed events, which event has the highest spend-to-budget ratio? | 1,376 | student_club | closed events refers to event_name where status = 'Closed'; highest spend-to budget ratio refers to MAX(DIVIDE(spent, amount)) |
simple | SELECT
MAX(`spent`)
FROM `budget` | What is the highest amount of budget spend for an event? | 1,378 | student_club | highest amount of budget spend refers to MAX(spent) |
simple | SELECT SUM(spent) FROM budget WHERE category = 'Food' | What is the total amount of money spent for food? | 1,380 | student_club | total amount of money spent refers to SUM(spent); spent for food refers to category = 'Food' |
moderate | 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 | List the name of students that have attended more than 7 events. | 1,381 | student_club | 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 |
moderate | 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' | Which student has been entrusted to manage the budget for the Yearly Kickoff? | 1,387 | student_club | name of students means the full name; full name refers to first_name, last_name;'Yearly Kickoff' is an event name; |
simple | 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`
LIMIT 1 | Which event has the lowest cost? | 1,389 | student_club | event refers to event_name; lowest cost means MIN(cost) |
moderate | SELECT
CAST(SUM(CASE WHEN `T1`.`event_name` = 'Yearly Kickoff' THEN `T3`.`cost` ELSE 0 END) AS DOUBLE) * 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` | Based on the total cost for all event, what is the percentage of cost for Yearly Kickoff event? | 1,390 | student_club | percentage = DIVIDE(SUM(cost where event_name = 'Yearly Kickoff'), SUM(cost)) * 100 |
simple | SELECT
`source`
FROM `income`
WHERE
`date_received` BETWEEN '2019-09-01' AND '2019-09-30'
ORDER BY
`source` DESC
LIMIT 1 | Indicate the top source of funds received in September 2019 based on their amount. | 1,392 | student_club | top source funds refers to MAX(source); September 2019 means date_received BETWEEN '2019-09-01' and '2019-09-30' |
simple | 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' | How many members of the Student_Club have major in 'Physics Teaching'? | 1,394 | student_club | 'Physics Teaching' is the major_name; |
moderate | 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 | Name the event with the highest amount spent on advertisement. | 1,398 | student_club | Name of event refers to event_name; highest amount spent on advertisement refers to MAX(spent) where category = 'Advertisement' |
moderate | SELECT
CASE WHEN `T3`.`event_name` = 'Women''s Soccer' THEN 'YES' END AS `result`
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' | Did Maya Mclean attend the 'Women's Soccer' event? | 1,399 | student_club | Maya Mclean is the full name; full name refers to first_name, last_name; 'Women's Soccer' is an event_name |
moderate | 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' | Indicate the cost of posters for 'September Speaker' event. | 1,401 | student_club | 'Posters' is the expense description; 'September Speaker' is an event name |
moderate | 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 | Indicate the name of the closed event whose cost has exceeded the budget the most. | 1,403 | student_club | closed events refers to event_name where status = 'Closed'; exceed the budget the most refers to MIN(remaining) where remaining < 0 |
moderate | SELECT `T1`.`type`, SUM(`T3`.`cost`) AS `total_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 `T1`.`type` | Identify the type of expenses and their total value approved for 'October Meeting' event. | 1,404 | student_club | total value refers to SUM(cost); 'October Meeting' is an event name; |
moderate | SELECT T2.category, SUM(T2.amount) FROM event AS T1 INNER 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 | Calculate the amount budgeted for 'April Speaker' event. List all the budgeted categories for said event in an ascending order based on their amount budgeted. | 1,405 | student_club | 'April Speaker' is an event name; amount budgeted refers to SUM(amount); budget categories refers to category |
simple | SELECT
SUM(`cost`)
FROM `expense`
WHERE
`expense_date` = '2019-08-20' | Mention the total expense used on 8/20/2019. | 1,409 | student_club | total expense refers SUM(cost) where expense_date = '2019-08-20' |
simple | 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' | List out the full name and total cost that member id "rec4BLdZHS2Blfp4v" incurred? | 1,410 | student_club | full name refers to first_name, last name |
simple | 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' | State what kind of expenses that Sacha Harrison incurred? | 1,411 | student_club | kind of expenses refers to expense_description; Sacha Harrison is the full name; full name refers to first_name, last_name; |
simple | 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' | State the category of events were held at MU 215. | 1,422 | student_club | 'MU 215' is the location of event; |
moderate | 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' | List the last name of members with a major in environmental engineering and include its department and college name. | 1,426 | student_club | 'Environmental Engineering' is the major_name; |
moderate | SELECT DISTINCT
`T2`.`category`,
`T1`.`type`
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' | What are the budget category of the events located at MU 215 and a guest speaker type with a 0 budget spent? | 1,427 | student_club | budget category refers to category; events located at refers to location; type = 'Guest Speaker'; 0 budget spent refers to spent = 0; |
moderate | SELECT
CAST(SUM(CASE WHEN `T2`.`amount` = 50 THEN 1.0 ELSE 0 END) AS DOUBLE) * 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' | Among the members with t-shirt size of medium, what is the percentage of the amount 50 received by the Student_Club? | 1,432 | student_club | t_shirt_size = 'Medium' where position = 'Member'; percentage = DIVIDE(COUNT(amount = 50), COUNT(member_id)) * 100 |
moderate | 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' | List the names of closed event as "game" that was closed from 3/15/2019 to 3/20/2020. | 1,435 | student_club | 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'; |
challenging | 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 `member` AS `T3`
ON `T3`.`member_id` = `T1`.`link_to_member`
) | Give the full name and contact number of members who had to spend more than average on each expense. | 1,457 | student_club | 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) |
challenging | 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' | Write the full name of the member who spent money for water, veggie tray and supplies and include the cost of it. | 1,460 | student_club | full name refers to first_name, last name; spent money for refers expense description; expense_description = 'Water, Veggie tray, supplies' |
challenging | 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' | Write the full names of students who received funds on the date of 9/9/2019 and include the amount received. | 1,464 | student_club | full name refers to first_name, last_name, amount of funds received refers to amount, received funds on date refers to date_received |
moderate | SELECT
CAST(SUM(CASE WHEN `Admission` = '+' THEN 1 ELSE 0 END) AS DOUBLE) * 100 / SUM(CASE WHEN `Admission` = '-' THEN 1 ELSE 0 END)
FROM `Patient`
WHERE
`SEX` = 'M' | Are there more in-patient or outpatient who were male? What is the deviation in percentage? | 1,149 | thrombosis_prediction | 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 = '-') |
moderate | SELECT
CAST(SUM(
CASE WHEN DATE_FORMAT(CAST(`Birthday` AS DATETIME), '%Y') > '1930' THEN 1 ELSE 0 END
) AS DOUBLE) * 100 / COUNT(*)
FROM `Patient`
WHERE
`SEX` = 'F' | What is the percentage of female patient were born after 1930? | 1,150 | thrombosis_prediction | 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') |
moderate | SELECT
SUM(CASE WHEN `Admission` = '+' THEN 1 ELSE 0 END) / SUM(CASE WHEN `Admission` = '-' THEN 1 ELSE 0 END)
FROM `Patient`
WHERE
`Diagnosis` = 'SLE' | What is the ratio of outpatient to inpatient followed up treatment among all the 'SLE' diagnosed patient? | 1,152 | thrombosis_prediction | '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 = '-') |
simple | SELECT
`T1`.`Diagnosis`,
`T2`.`Date`
FROM `Patient` AS `T1`
INNER JOIN `Laboratory` AS `T2`
ON `T1`.`ID` = `T2`.`ID`
WHERE
`T1`.`ID` = 30609 | What is the disease patient '30609' diagnosed with. List all the date of laboratory tests done for this patient. | 1,153 | thrombosis_prediction | '30609' is the Patient ID; disease means Diagnosis |
simple | 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 | List the patient ID, sex and birthday of patient with LDH beyond normal range. | 1,155 | thrombosis_prediction | LDH beyond normal range refers to LDH > '500'; |
moderate | SELECT DISTINCT
`T1`.`ID`,
DATE_FORMAT(CAST(CURRENT_TIMESTAMP() AS DATETIME), '%Y') - DATE_FORMAT(CAST(`T1`.`Birthday` AS DATETIME), '%Y')
FROM `Patient` AS `T1`
INNER JOIN `Examination` AS `T2`
ON `T1`.`ID` = `T2`.`ID`
WHERE
`T2`.`RVVT` = '+' | State the ID and age of patient with positive degree of coagulation. | 1,156 | thrombosis_prediction | age refers to SUBTRACT(year(current_timestamp), year(Birthday)); positive degree of coagulation refers to RVVT = '+'; |
simple | 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 | For patients with severe degree of thrombosis, list their ID, sex and disease the patient is diagnosed with. | 1,157 | thrombosis_prediction | severe degree of thrombosis refers to thrombosis = 2; disease refers to diagnosis; |
moderate | SELECT
COUNT(*)
FROM `Patient`
WHERE
DATE_FORMAT(CAST(`Description` AS DATETIME), '%Y') = '1997'
AND `SEX` = 'F'
AND `Admission` = '-' | How many female patients who came at the hospital in 1997 was immediately followed at the outpatient clinic? | 1,162 | thrombosis_prediction | 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 = '-' |
moderate | SELECT
COUNT(*)
FROM `Patient` AS `T1`
INNER JOIN `Examination` AS `T2`
ON `T1`.`ID` = `T2`.`ID`
WHERE
`T1`.`SEX` = 'F'
AND DATE_FORMAT(CAST(`T2`.`Examination Date` AS DATETIME), '%Y') = '1997'
AND `T2`.`Thrombosis` = 1 | How many of the patients with the most serious thrombosis cases examined in 1997 are women? | 1,164 | thrombosis_prediction | the most serious thrombosis refers to Thrombosis = '1' (the most severe one); women refers to sex = 'F' |
simple | SELECT
`T2`.`Symptoms`,
`T1`.`Diagnosis`
FROM `Patient` AS `T1`
INNER JOIN `Examination` AS `T2`
ON `T1`.`ID` = `T2`.`ID`
WHERE
NOT `T2`.`Symptoms` IS NULL
ORDER BY
`T1`.`Birthday` DESC
LIMIT 1 | What are the symptoms observed by the youngest patient to ever did a medical examination? Identify their diagnosis. | 1,166 | thrombosis_prediction | The larger the birthday value, the younger the person is, and vice versa; symptoms observed refers to the symptoms is not NULL |
challenging | SELECT
`T1`.`Date`,
DATE_FORMAT(CAST(`T2`.`First Date` AS DATETIME), '%Y') - DATE_FORMAT(CAST(`T2`.`Birthday` AS DATETIME), '%Y'),
`T2`.`Birthday`
FROM `Laboratory` AS `T1`
INNER JOIN `Patient` AS `T2`
ON `T1`.`ID` = `T2`.`ID`
WHERE
`T2`.`Diagnosis` = 'SJS' AND NOT `T2`.`Birthday` IS NULL
ORDER BY
`T2`.`Birthday` ASC
LIMIT 1 | The oldest SJS patient's medical laboratory work was completed on what date, and what age was the patient when they initially arrived at the hospital? | 1,168 | thrombosis_prediction | The larger the birthday value, the younger the person is, and vice versa; 'SJS' refers to diagnosis; (SUBTRACT(year(`First Date`)), year(Birthday)); age of the patients when they initially arrived at the hospital refers to year(Birthday) |
challenging | SELECT
CAST(SUM(CASE WHEN `T2`.`UA` <= 8.0 AND `T1`.`SEX` = 'M' THEN 1 ELSE 0 END) AS DOUBLE) / SUM(CASE WHEN `T2`.`UA` <= 6.5 AND `T1`.`SEX` = 'F' THEN 1 ELSE 0 END)
FROM `Patient` AS `T1`
INNER JOIN `Laboratory` AS `T2`
ON `T1`.`ID` = `T2`.`ID` | What is the ratio of male to female patients among all those with abnormal uric acid counts? | 1,169 | thrombosis_prediction | 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')) |
challenging | SELECT
COUNT(`T1`.`ID`)
FROM `Patient` AS `T1`
INNER JOIN `Examination` AS `T2`
ON `T1`.`ID` = `T2`.`ID`
WHERE
DATE_FORMAT(CAST(`T2`.`Examination Date` AS DATETIME), '%Y') BETWEEN '1990' AND '1993'
AND DATE_FORMAT(CAST(`T2`.`Examination Date` AS DATETIME), '%Y') - DATE_FORMAT(CAST(`T1`.`Birthday` AS DATETIME), '%Y') < '18' | How many underage patients were examined during the course of the three-year period from 1990 to 1993? | 1,171 | thrombosis_prediction | underage patients refers to year(Birthday) < 18; three-year period from 1990 to 1993 refers to year(`Examination Date`) between '1990' and '1993' |
moderate | SELECT
DATE_FORMAT(CAST(`T2`.`Date` AS DATETIME), '%Y') - DATE_FORMAT(CAST(`T1`.`Birthday` AS DATETIME), '%Y'),
`T1`.`Diagnosis`
FROM `Patient` AS `T1`
INNER JOIN `Laboratory` AS `T2`
ON `T1`.`ID` = `T2`.`ID`
ORDER BY
`T2`.`HGB` DESC
LIMIT 1 | How old was the patient who had the highest hemoglobin count at the time of the examination, and what is the doctor's diagnosis? | 1,175 | thrombosis_prediction | How old the patient refers to SUBTRACT(year(`Examination Date`), year(Birthday)); the highest hemoglobin count refers to MAX(HGB) |
moderate | SELECT
`aCL IgA`,
`aCL IgG`,
`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' | 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? | 1,179 | thrombosis_prediction | 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' |
challenging | 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 DOUBLE) / SUM(CASE WHEN `T2`.`Date` LIKE '1981-12-%' 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-18' | 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? | 1,185 | thrombosis_prediction | 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-12-%' THEN `T-CHO`)) |
moderate | SELECT DISTINCT
`ID`
FROM `Laboratory`
WHERE
`Date` BETWEEN '1987-07-06' AND '1996-01-31' AND `GPT` > 30 AND `ALB` < 4 | 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. | 1,187 | thrombosis_prediction | 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 |
challenging | 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'
) | 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? | 1,189 | thrombosis_prediction | 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) |
challenging | 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-%' | 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. | 1,192 | thrombosis_prediction | 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; |
moderate | 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' | What is the average blood albumin level for female patients with a PLT greater than 400 who have been diagnosed with SLE? | 1,195 | thrombosis_prediction | 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' |
simple | SELECT
COUNT(`ID`)
FROM `Patient`
WHERE
`SEX` = 'F' AND `Diagnosis` = 'APS' | How many female patients were given an APS diagnosis? | 1,198 | thrombosis_prediction | female refers to SEX = 'F'; APS diagnosis refers to Diagnosis='APS' |
moderate | SELECT
CAST(SUM(CASE WHEN `SEX` = 'F' THEN 1 ELSE 0 END) AS DOUBLE) * 100 / COUNT(`ID`)
FROM `Patient`
WHERE
`Diagnosis` = 'RA' AND DATE_FORMAT(CAST(`Birthday` AS DATETIME), '%Y') = '1980' | What percentage of patients who were born in 1980 and were diagnosed with RA are women? | 1,201 | thrombosis_prediction | born in 1980 refers to YEAR(BIRTHDAY) = '1980'; 'RA' refers to Diagnosis='RA' ; women refers to SEX = 'F'; calculation = DIVIDE(SUM(SEX = 'F'), COUNT(SEX)) * 100 |
No dataset card yet
New: Create and edit this dataset card directly on the website!
Contribute a Dataset Card