target-benchmark/bird-queries-validation huggingface dataset:
Database: thrombosis_prediction
Question: Among the male patients who have a normal level of white blood cells, how many of them have an abnormal fibrinogen level?
Evidence: male patients refers to Sex = 'M'; normal level of white blood cells refers to WBC between 3.5 and 9.0; abnormal fibrinogen level refers to FG < = 150 or FG > = 450; Don't compute repetitive ones.
SQL: SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.FG <= 150 OR T2.FG >= 450 AND T2.WBC > 3.5 AND T2.WBC < 9.0 AND T1.SEX = 'M'
Database: thrombosis_prediction
Question: How many patients with an Ig G lower than normal has the symptom of abortion?
Evidence: Ig G lower than normal refers to IGG < 900; symptom of abortion refers to Symptoms = 'abortion';
SQL: SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID INNER JOIN Examination AS T3 ON T3.ID = T2.ID WHERE T2.IGG < 900 AND T3.Symptoms = 'abortion'
Database: thrombosis_prediction
Question: Among the patients with a normal Ig G level, how many of them have symptoms?
Evidence: normal Ig G level refers to IGG BETWEEN 900 AND 2000; have symptoms refers to Symptoms IS NOT NULL;
SQL: SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID INNER JOIN Examination AS T3 ON T3.ID = T2.ID WHERE T2.IGG BETWEEN 900 AND 2000 AND T3.Symptoms IS NOT NULL
Database: thrombosis_prediction
Question: How many patients with a normal Ig A level came to the hospital after 1990/1/1?
Evidence: normal Ig A level refers to IGA BETWEEN 80 AND 500; came to the hospital after 1990/1/1 refers to YEAR(`First Date`) > = 1990;
SQL: SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.IGA BETWEEN 80 AND 500 AND T1.`First Date` > '1990-01-01'
Database: thrombosis_prediction
Question: For the patients with an abnormal Ig M level, what is the most common disease they are diagnosed with?
Evidence: abnormal Ig M level refers to IGM NOT BETWEEN 40 AND 400; most common disease refers to MAX(COUNT(Diagnosis));
SQL: SELECT T1.Diagnosis FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.IGM NOT BETWEEN 40 AND 400 GROUP BY T1.Diagnosis ORDER BY COUNT(T1.Diagnosis) DESC LIMIT 1
Database: thrombosis_prediction
Question: How many patients with a normal C-reactive protein don't have their data recorded?
Evidence: normal C-reactive protein refers to CRP LIKE '+' OR CRP LIKE '-' OR CRP < 1.0; don't have data recorded refers to Description IS NULL;
SQL: SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE (T2.CRP = '-' OR T2.CRP = '+-' OR T2.CRP < 1.0) AND T1.Description IS NULL
Database: thrombosis_prediction
Question: Among the patients whose C-reactive protein level is abnormal, how many of them aren't 18 yet?
Evidence: C-reactive protein level is abnormal refers to CRP NOT IN('+-', '-') AND CRP > = 1.0; aren't 18 refers = CRP > = 1.0 AND SUBTRACT((YEAR(CURDATE()), YEAR(Birthday))) < 18; Should compute the number of distinct ones.
SQL: SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE (T2.CRP != '-' AND T2.CRP != '+-') AND T2.CRP >= 1.0 AND STRFTIME('%Y', Date('now')) - STRFTIME('%Y', T1.Birthday) < '18'
Database: thrombosis_prediction
Question: Please list the diseases of the patients born after 1995-1-1 and have a normal Rhuematoid Factor.
Evidence: diseases refers to Diagnosis; born after 1995/1/1 refers to YEAR(Birthday) > = 1995; normal Rhuematoid Factor refers to RA IN('-', '+-');
SQL: SELECT T1.Diagnosis FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE (T2.RA = '-' OR T2.RA = '+-') AND T1.Birthday > 1995-01-01
Database: thrombosis_prediction
Question: How many patients have a normal level of anti-ribonuclear protein and have been admitted to the hospital?
Evidence: normal level of anti-ribonuclear protein refers to RNP = '-', '+-'; And'-' means 'negative'; '+-' refers to '0'; admitted to the hospital refers to Admission = '+'; Should compute the number of distinct ones
SQL: SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.RNP = 'negative' OR T2.RNP = '0' AND T1.Admission = '+'
Database: thrombosis_prediction
Question: Among the patients with normal anti-SM, how many of them have the most severe degree of thrombosis?
Evidence: normal anti-SM refers to SM IN('-', '+-'); SM = 'negative' means '-'; SM = '0' means '+-'; SM = '1' means '+'; most severe degree of thrombosis refers to Thrombosis = '1';
SQL: SELECT COUNT(T1.ID) FROM Examination AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.SM IN ('negative','0') AND T1.Thrombosis = 1
Database: thrombosis_prediction
Question: For the patients with an abnormal anti-SM, please list the IDs of the three youngest ones.
Evidence: abnormal anti-SM refers to SM NOT IN('-', '+-'); youngest refers to MAX(Birthday);
SQL: SELECT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.SM NOT IN ('negative','0') ORDER BY T1.Birthday DESC LIMIT 3
Database: thrombosis_prediction
Question: Please list the IDs of the patients who had the examination done after 1997/1/1 and had a normal anti-scl70.
Evidence: examination done after 1997/1/1 refers to `Examination Date` > = 1997-01-01; normal anti-scl70 refers to SC170 IN('-', '+-');
SQL: SELECT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.SC170 IN ('negative','0') AND T2.Date > 1997-01-01
Database: thrombosis_prediction
Question: Among the patients who has a normal anti-scl70, how many of them are male and have the symptom of vertigo?
Evidence: normal anti-scl70 refers to SC170 IN('-', '+-'); male refers to Sex = 'M'; symptom of vertigo refers to symptoms = 'vertigo'; Should compute the number of distinct ones
SQL: SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID INNER JOIN Examination AS T3 ON T3.ID = T2.ID WHERE (T2.SC170 = '-' OR T2.SC170 = '+-') AND T1.SEX = 'M' AND T3.Symptoms = 'vertigo'
Database: thrombosis_prediction
Question: How many patients with a normal anti-SSA came to the hospital before 1990?
Evidence: normal anti-SSA refers to SSA IN('-','+-'); came to the hospital before 1990 refers to YEAR(`First Date`) < 1990; Should compute the number of distinct ones
SQL: SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.SSA IN ('negative', '0') AND STRFTIME('%Y', T2.Date) < '1990'
Database: thrombosis_prediction
Question: Which patient is the first patient with an abnormal anti-SSA to come to the hospital? Please give his or her ID.
Evidence: first patient refers to ID with MIN(`First Date`); abnormal anti-SSA refers to SSA NOT IN('-', '+-');
SQL: SELECT T1.ID FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.`First Date` IS NOT NULL AND T2.SSA NOT IN ('negative', '0') ORDER BY T1.`First Date` ASC LIMIT 1
Database: thrombosis_prediction
Question: For the patients whose anti-SSB are normal, how many of them have other symptoms observed in their examination?
Evidence: anti-SSB are normal refers to SSB IN('-', '+-'); have other symptoms refers to Symptoms IS NOT NULL; Should compute the number of distinct ones
SQL: SELECT COUNT(DISTINCT T1.ID) FROM Examination AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.SSB = 'negative' OR '0' AND T1.Symptoms IS NOT NULL
Database: thrombosis_prediction
Question: Among the patients who has a normal level of anti-centromere and a normal level of anti-SSB, how many of them are male?
Evidence: normal level of anti-centromere refers to CENTROMEA IN('-', '+-'); normal level of anti-SSB refers to SSB IN('-', '+-'); male refers to Sex = 'M';
SQL: SELECT COUNT(DISTINCT T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.CENTROMEA IN ('negative', '0') AND T2.SSB IN ('negative', '0') AND T1.SEX = 'M'
Database: thrombosis_prediction
Question: Of the patients with an abnormal level of anti-DNA-II, how many of them admitted to the hospital?
Evidence: normal level of anti-DNA-II refers to DNA-II < 8; admitted to the hospital refers to Admission = '+';
SQL: SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.`DNA-II` >= 8 AND T1.Admission = '+'
Database: thrombosis_prediction
Question: Among the patients who have an abnormal level of glutamic oxaloacetic transaminase, when was the youngest of them born?
Evidence: abnormal level of glutamic oxaloacetic transaminase refers to GOT > = 60; youngest refers to MAX(Birthday);
SQL: SELECT T1.Birthday FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.GOT >= 60 ORDER BY T1.Birthday DESC LIMIT 1
Database: thrombosis_prediction
Question: For the patient with the highest lactate dehydrogenase in the normal range, when was his or her data first recorded?
Evidence: highest lactate dehydrogenase in the normal range refers to MAX(LDH < 500); when the data first recorded refers to MIN(First Date);
SQL: SELECT T1.`First Date` FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.LDH < 500 ORDER BY T2.LDH DESC LIMIT 1
Database: thrombosis_prediction
Question: What is the examination date of the patient whose albumin is the highest in the normal range?
Evidence: examination date refers to Date; albumin is the highest in the normal range refers to MAX(ALB > 3.5 and ALB < 5.5);
SQL: SELECT Date FROM Laboratory WHERE ALB BETWEEN 3.5 AND 5.5 ORDER BY ALB DESC LIMIT 1
Database: thrombosis_prediction
Question: How many male patients have a normal level of both albumin and total protein?
Evidence: male refers to Sex = 'M'; normal level of both albumin and total protein refers to ALB > 3.5 and ALB < 5.5 AND TP between 6.0 and 8.5;
SQL: SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T1.SEX = 'M' AND T2.ALB BETWEEN 3.5 AND 5.5 AND T2.TP BETWEEN 6.0 AND 8.5
Database: thrombosis_prediction
Question: Among the patients who have a normal platelet level, how many of them have other symptoms observed?
Evidence: normal platelet level refers to PLT > 100 and PLT < 400; have other symptoms refers to Diagnosis is not null;
SQL: SELECT COUNT(T1.ID) FROM Patient AS T1 INNER JOIN Laboratory AS T2 ON T1.ID = T2.ID WHERE T2.PLT BETWEEN 100 AND 400 AND T1.Diagnosis IS NOT NULL
Database: student_club
Question: What's Angela Sanders's major?
Evidence: major refers to major_name
SQL: 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'
Database: student_club
Question: Among the events attended by more than 10 members of the Student_Club, how many of them are meetings?
Evidence: meetings events refers to type = 'Meeting'; attended by more than 10 members refers to COUNT(event_id) > 10
SQL: SELECT COUNT(T1.event_id) FROM event AS T1 INNER JOIN attendance AS T2 ON T1.event_id = T2.link_to_event WHERE T1.type = 'Meeting' GROUP BY T1.type HAVING COUNT(T2.link_to_event) > 10
Database: student_club
Question: Please list the names of all the events of the Student_Club that had an attendance of over 20 students.
Evidence: name of events refers to event_name; attendance of over 20 students COUNT(event_id) > 20
SQL: 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
Database: student_club
Question: What is the amount of the funds that the Vice President received?
Evidence: 'Vice President' is a position of Student Club; funds received refers to amount;
SQL: 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'
Database: student_club
Question: Calculate the total average cost that Elijah Allen spent in the events on September and October.
Evidence: events in September and October refers to month(expense_date) = 9 AND MONTH(expense_date) = 10
SQL: 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')
Database: student_club
Question: Calculate the difference of the total amount spent in all events by the Student_Club in year 2019 and 2020.
Evidence: SUBTRACT(spent where YEAR(event_date) = 2019, spent where YEAR(event_date) = 2020)
SQL: 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
Database: student_club
Question: Tell the phone number of "Carlo Jacobs".
SQL: SELECT phone FROM member WHERE first_name = 'Carlo' AND last_name = 'Jacobs'
Database: student_club
Question: What was Brent Thomason's major?
Evidence: major refers to major_name
SQL: 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'
Database: student_club
Question: For all the club members from "Human Development and Family Studies" major, how many of them wear large size t-shirt?
Evidence: 'Human Development and Family Studies' is a major name; wear large size t-shirt refers to t_shirt_size = 'Large'
SQL: 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 = 'Human Development AND Family Studies' AND T1.t_shirt_size = 'Large'
Database: student_club
Question: State the date Connor Hilton paid his/her dues.
Evidence: date the dues was paid refers to received_date where source = 'Dues'
SQL: 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'
Database: student_club
Question: How many times was the budget in Advertisement for "Yearly Kickoff" meeting more than "October Meeting"?
Evidence: DIVIDE(SUM(amount where category = 'Advertisement' and event_name = 'Yearly Kickoff'), SUM(amount event_name = 'October Meeting' and category = 'Advertisement'))
SQL: 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'
Database: student_club
Question: How many cities are there in Orange County, Virginia?
Evidence: Orange County is the county, Virginia is the state
SQL: SELECT COUNT(city) FROM zip_code WHERE county = 'Orange County' AND state = 'Virginia'
Database: student_club
Question: What is the total expense for the Yearly Kickoff?
Evidence: 'Baseball game' is an event name; total expense refers to SUM(cost)
SQL: SELECT 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 = 'Yearly Kickoff'
Database: student_club
Question: Which student has been entrusted to manage the budget for the Yearly Kickoff?
Evidence: 'Yearly Kickoff' is an event name;
SQL: 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'
Database: student_club
Question: Which event has the lowest cost?
Evidence: event refers to event_name where MIN(cost)
SQL: 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
Database: student_club
Question: Based on the total cost for all event, what is the percentage of cost for Yearly Kickoff event?
Evidence: DIVIDE(SUM(cost where event_name = 'Yearly Kickoff'), SUM(cost)) * 100
SQL: 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
Database: student_club
Question: Indicate the top source of funds received in September 2019 based on their amount.
Evidence: top source funds refers to MAX(source) where date_received BETWEEN '2019-09-01' and '2019-09-30'
SQL: SELECT source FROM income WHERE date_received BETWEEN '2019-09-01' and '2019-09-30' ORDER BY source DESC LIMIT 1
Database: student_club
Question: How many members of the Student_Club have major in 'Physics Teaching'?
Evidence: 'Physics Teaching' is the major name;
SQL: 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'
Database: student_club
Question: Name the event with the highest amount spent on advertisement.
Evidence: event refers to event_name; highest amount spent on advertisement refers to MAX(spent) where category = 'Advertisement'
SQL: 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
Database: student_club
Question: Did Maya Mclean attend the 'Women's Soccer' event?
Evidence: 'Women's Soccer' is an event name
SQL: 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'
Database: student_club
Question: Calculate the amount budgeted for 'April Speaker' event. List all the budgeted categories for said event in an ascending order based on their amount.
Evidence: 'April Speaker' is an event name; amount budgeted refers to budget; budget categories refers to category
SQL: SELECT SUM(T2.amount), T2.category FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.event_name = 'April Speaker' ORDER BY T2.amount
Database: student_club
Question: State what kind of expenses that Sacha Harrison incurred?
Evidence: kind of expenses refers to expense_description
SQL: 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'
Database: student_club
Question: Calculate the percentage of members who are major Mathematics in the list?
Evidence: DIVIDE(SUM(position = 'Member' and major_name = 'Mathematics'), COUNT(member_id)) * 100
SQL: SELECT CAST(SUM(CASE WHEN T2.major_name = 'Mathematics' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.member_id) FROM member AS T1 INNER JOIN major AS T2 ON T2.major_id = T1.link_to_major WHERE T1.position = 'Member'
Database: student_club
Question: State the category of events were held at MU 215.
Evidence: 'MU 215' is the location of event
SQL: SELECT T2.category FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.location = 'MU 215'
Database: student_club
Question: In the College of Agriculture and Applied Sciences, how many majors are under the department of School of Applied Sciences, Technology and Education?
SQL: SELECT COUNT(major_id) FROM major WHERE department = 'School of Applied Sciences, Technology AND Education' AND college = 'College of Agriculture AND Applied Sciences'
Database: student_club
Question: List the last name of members with a major in environmental engineering and include its department and college name.
Evidence: 'Environmental Engineering' is the major name;
SQL: 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'
Database: student_club
Question: What are the budget category of the events located at MU 215 and a guest speaker type with a 0 budget spent?
Evidence: budget category refers to category; events located at refers to location; type = 'Guest Speaker'; 0 budget spent refers to spent = 0
SQL: 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'
Database: student_club
Question: List the names of closed event as "game" that was closed from 3/15/2019 to 3/20/2020.
Evidence: 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'
SQL: 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'
Database: student_club
Question: Calculate the percentage of zip codes that are PO boxes.
Evidence: DIVIDE(SUM(type = 'PO Box'), COUNT(zip_code)) * 100
SQL: SELECT CAST(SUM(CASE WHEN type = 'PO box' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(zip_code) FROM zip_code
Database: student_club
Question: What is the percentage of the cost for the game events?
Evidence: game events refers to type = 'Game'; percentage = DIVIDE( SUM(cost), COUNT(event_id)) * 100
SQL: SELECT SUM(CASE WHEN T1.type = 'Game' THEN T3.cost ELSE 0 END) * 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
Database: student_club
Question: Calculate the difference in the percentage of members in Maine and Vermont.
Evidence: SUBTRACT( DIVIDE( SUM(state = 'Maine'), COUNT(position = 'Member')), DIVIDE( SUM(state = 'Vermont'), COUNT(position = 'Member')) )
SQL: SELECT CAST((SUM(CASE WHEN T2.state = 'Maine' THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.state = 'Vermont' THEN 1 ELSE 0 END)) AS REAL) * 100 / COUNT(T1.member_id) AS diff FROM member AS T1 INNER JOIN zip_code AS T2 ON T2.zip_code = T1.zip
Database: student_club
Question: Calculate the total amount spent on speaker gifts and list the name of the event they were spent on.
Evidence: total amount spent = SUM(spent) where category = 'Speaker Gifts'
SQL: SELECT SUM(T1.spent), T2.event_name FROM budget AS T1 INNER JOIN event AS T2 ON T1.link_to_event = T2.event_id WHERE T1.category = 'Speaker Gifts'
Database: student_club
Question: Where is the hometown of Garrett Girke?
Evidence: hometown refers to city
SQL: SELECT T2.city FROM member AS T1 INNER JOIN zip_code AS T2 ON T2.zip_code = T1.zip WHERE T1.first_name = 'Garrett' AND T1.last_name = 'Gerke'
Database: debit_card_specializing
Question: What is the ratio of costumers who pay in EUR against customers who pay in CZK?
Evidence: ratio of costumers who pay in EUR against customers who pay in CZK = count(Currency = 'EUR') / count(Currency = 'CZK').
SQL: SELECT CAST(SUM(IIF(Currency = 'EUR', 1, 0)) AS FLOAT) / SUM(IIF(Currency = 'CZK', 1, 0)) FROM customers
Database: debit_card_specializing
Question: In 2012, who had the least consumption in LAM?
Evidence: Year 2012 can be presented as Between 201201 And 201212, which means between January and December in 2012
SQL: SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'LAM' AND T2.date BETWEEN 201201 AND 201212 GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) ASC LIMIT 1
Database: debit_card_specializing
Question: What was the average monthly consumption of customers in SME for the year 2013?
Evidence: Average Monthly consumption = AVG(Consumption) / 12; Year 2013 can be presented as Between 201301 And 201312, which means between January and December in 2013
SQL: SELECT AVG(T2.Consumption) / 12 FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTRING(T2.Date, 1, 4) = '2013' AND T1.Segment = 'SME'
Database: debit_card_specializing
Question: What was the difference in gas consumption between CZK-paying customers and EUR-paying customers in 2012?
Evidence: Year 2012 can be presented as Between 201201 And 201212, which means between January and December in 2012; Difference in Consumption = CZK customers consumption in 2012 - EUR customers consumption in 2012
SQL: 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 SUBSTRING(T2.Date, 1, 4) = '2012'
Database: debit_card_specializing
Question: Which year recorded the most consumption of gas paid in CZK?
Evidence: The first 4 strings of the values in the table yearmonth can represent year.
SQL: SELECT SUBSTRING(T2.Date, 1, 4) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'CZK' GROUP BY SUBSTRING(T2.Date, 1, 4) ORDER BY SUM(T2.Consumption) DESC LIMIT 1
Database: debit_card_specializing
Question: What was the gas consumption peak month for SME customers in 2013?
Evidence: 'in 2013' refers to the first 4 strings of yearmonth.date = '2013', The 5th and 6th string of the date can refer to month.
SQL: SELECT SUBSTRING(T2.Date, 5, 2) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTRING(T2.Date, 1, 4) = '2013' AND T1.Segment = 'SME' GROUP BY SUBSTRING(T2.Date, 5, 2) ORDER BY SUM(T2.Consumption) DESC LIMIT 1
Database: debit_card_specializing
Question: 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?
Evidence: 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; First 4 strings of Date represents the year.
SQL: SELECT CAST(SUM(IIF(T1.Segment = 'SME', T2.Consumption, 0)) AS FLOAT) / COUNT(T1.CustomerID) - CAST(SUM(IIF(T1.Segment = 'LAM', T2.Consumption, 0)) AS FLOAT) / COUNT(T1.CustomerID) , CAST(SUM(IIF(T1.Segment = 'LAM', T2.Consumption, 0)) AS FLOAT) / COUNT(T1.CustomerID) - CAST(SUM(IIF(T1.Segment = 'KAM', T2.Consumption, 0)) AS FLOAT) / COUNT(T1.CustomerID) , CAST(SUM(IIF(T1.Segment = 'KAM', T2.Consumption, 0)) AS FLOAT) / COUNT(T1.CustomerID) - CAST(SUM(IIF(T1.Segment = 'SME', T2.Consumption, 0)) AS FLOAT) / 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
Database: debit_card_specializing
Question: 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?
Evidence: Increase or Decrease = consumption for 2013 - consumption for 2012; Percentage of Increase = (Increase or Decrease / consumption for 2013) * 100%; Between 2012 And 2013 can be represented by Between 201201 And 201312; First 4 strings of Date represents the year.
SQL: 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.Consumption, 0)) - SUM(IIF(T1.Segment = 'LAM' AND T2.Date LIKE '2012%', T2.Consumption, 0)) AS FLOAT) * 100 / SUM(IIF(T1.Segment = 'LAM' AND T2.Date LIKE '2012%', T2.Consumption, 0)) , CAST(SUM(IIF(T1.Segment = 'KAM' AND T2.Date LIKE '2013%', T2.Consumption, 0)) - SUM(IIF(T1.Segment = 'KAM' AND T2.Date LIKE '2012%', T2.Consumption, 0)) AS FLOAT) * 100 / SUM(IIF(T1.Segment = 'KAM' AND T2.Date LIKE '2012%', T2.Consumption, 0)) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID
Database: debit_card_specializing
Question: How much did customer 6 consume in total between August and November 2013?
Evidence: Between August And November 2013 refers to Between 201308 And 201311; First 4 strings of Date represents the year.
SQL: SELECT SUM(Consumption) FROM yearmonth WHERE CustomerID = 6 AND Date BETWEEN '201308' AND '201311'
Database: debit_card_specializing
Question: How many more "discount" gas stations does the Czech Republic have compared to Slovakia?
Evidence: Computation of more discount = Total no. of discount gas stations in Czech Republic - Total no. of discount gas stations in Slovakia
SQL: SELECT SUM(IIF(Country = 'CZE', 1, 0)) - SUM(IIF(Country = 'SVK', 1, 0)) FROM gasstations WHERE Segment = 'Discount'
Database: debit_card_specializing
Question: Is it true that more SMEs pay in Czech koruna than in euros? If so, how many more?
Evidence: Amount of more SMEs = Total of SMEs uses Czech Koruna - Total of SMEs uses Euro
SQL: SELECT SUM(Currency = 'CZK') - SUM(Currency = 'EUR') FROM customers WHERE Segment = 'SME'
Database: debit_card_specializing
Question: How many percent of LAM customer consumed more than 46.73?
Evidence: 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%.
SQL: SELECT CAST(SUM(IIF(T2.Consumption > 46.73, 1, 0)) AS FLOAT) * 100 / COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'LAM'
Database: debit_card_specializing
Question: In February 2012, what percentage of customers consumed more than 528.3?
Evidence: February 2012 refers to '201202' in yearmonth.date
SQL: SELECT CAST(SUM(IIF(Consumption > 528.3, 1, 0)) AS FLOAT) * 100 / COUNT(CustomerID) FROM yearmonth WHERE Date = '201202'
Database: debit_card_specializing
Question: What is the highest monthly consumption in the year 2012?
Evidence: The first 4 strings of yearmonth.date can represent the year.
SQL: SELECT SUM(Consumption) FROM yearmonth WHERE SUBSTRING(Date, 1, 4) = '2012' GROUP BY SUBSTRING(Date, 5, 2) ORDER BY SUM(Consumption) DESC LIMIT 1
Database: debit_card_specializing
Question: Please list the product description of the products consumed in September, 2013.
Evidence: September 2013 refers to 201309; First 4 strings represent the year
SQL: 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'
Database: debit_card_specializing
Question: Please list the countries of the gas stations with transactions taken place in June, 2013.
Evidence: June 2013 refers to '201306'; First 4 strings represent the year
SQL: SELECT 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'
Database: debit_card_specializing
Question: Among the customers who paid in euro, how many of them have a monthly consumption of over 1000?
SQL: 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
Database: debit_card_specializing
Question: Please list the product descriptions of the transactions taken place in the gas stations in the Czech Republic.
Evidence: Gas station in the Czech Republic implies that Country = CZE
SQL: SELECT 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'
Database: debit_card_specializing
Question: Among the transactions made in the gas stations in the Czech Republic, how many of them are taken place after 2012/1/1?
Evidence: Gas station in the Czech Republic implies that Country = 'CZE'
SQL: 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'
Database: debit_card_specializing
Question: What kind of currency did the customer paid at 16:25:00 in 2012/8/24?
Evidence: '2012/8/24' can be represented by '2012-08-24'
SQL: SELECT 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'
Database: debit_card_specializing
Question: What segment did the customer have at 2012/8/23 21:20:00?
Evidence: '2012/8/23 21:20:00' can refer to date = '2012-08-23' AND T1.time = '21:20:00' in the database
SQL: 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'
Database: debit_card_specializing
Question: How many transactions were paid in EUR in the morning of 2012/8/26?
Evidence: '2012/8/26' can be represented by '2012-08-26'; The morning refers to the time before '13:00:00'
SQL: SELECT COUNT(T1.TransactionID) FROM transactions_1k AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Date = '2012-08-26' AND T1.Time < '13:00:00' AND T2.Currency = 'EUR'
Database: debit_card_specializing
Question: For all the transactions happened during 8:00-9:00 in 2012/8/26, how many happened in CZE?
Evidence: Gas station in the Czech Republic implies that Country = CZE; '2012/8/26' can be represented by '2012-08-26'
SQL: 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'
Database: debit_card_specializing
Question: For the customer who paid 634.8 in 2012/8/25, what was the consumption decrease rate from Year 2012 to 2013?
Evidence: '2012/8/24' can be represented by '2012-08-24'; Consumption decrease rate = (consumption_2012 - consumption_2013) / consumption_2012
SQL: 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.GasStationID = T2.GasStationID WHERE T1.Date = '2012-08-25' AND T1.Price = 634.8 )
Database: debit_card_specializing
Question: What is the percentage of "premium" against the overall segment in "SVK"?
SQL: SELECT CAST(SUM(IIF(Country = 'SVK' AND Segment = 'Premium', 1, 0)) AS FLOAT) * 100 / SUM(IIF(Country = 'SVK', 1, 0)) FROM gasstations
Database: debit_card_specializing
Question: What is the amount spent by customer "38508" at the gas stations? How much had the customer spent in January 2012?
Evidence: January 2012 refers '201201' in the table transactions_1k
SQL: SELECT SUM(T1.Price) , SUM(IIF(T3.Date = '201201', T1.Price, 0)) 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'
Database: debit_card_specializing
Question: 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?
Evidence: verage price per single item = price / amount
SQL: 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
Database: debit_card_specializing
Question: 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.
Evidence: August of 2012 means Date contains '201208' in the yearmonth.date of the database; Price per unit of product = Price / Amount
SQL: 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'