Chinastark/bird_dataset huggingface dataset:
Database: student_club
Note: kind of expenses refers to expense_description; Sacha Harrison is the full name; full name refers to first_name, last_name;
Question: State what kind of expenses that Sacha Harrison incurred?
SQL: SELECT expense.expense_description FROM member INNER JOIN expense ON member.member_id = expense.link_to_member WHERE member.first_name = 'Sacha' AND member.last_name = 'Harrison'
Database: student_club
Note: kind of expenses refers to expense_description; t_shirt_size = 'X-Large';
Question: What kind of expenses incurred by members who have X-Large in size of tee shirt?
SQL: SELECT expense.expense_description FROM member INNER JOIN expense ON member.member_id = expense.link_to_member WHERE member.t_shirt_size = 'X-Large'
Database: student_club
Note: incurred less than 50USD refers to cost < 50;
Question: Mention the zip code of member who incurred less than 50USD.
SQL: SELECT member.zip FROM member INNER JOIN expense ON member.member_id = expense.link_to_member WHERE expense.cost < 50
Database: student_club
Note: name of major refers to major_name;
Question: State the name of major that Phillip Cullen has joined.
SQL: SELECT major.major_name FROM major INNER JOIN member ON major.major_id = member.link_to_major WHERE member.first_name = 'Phillip' AND member.last_name = 'Cullen'
Database: student_club
Note: 'Business' is the major name;
Question: List out the position of members who joined major of Business.
SQL: SELECT member.position FROM major INNER JOIN member ON major.major_id = member.link_to_major WHERE major.major_name = 'Business'
Database: student_club
Note: members of Economics refers to major_name = 'Business'; t_shirt_size = 'Medium';
Question: How many members of Business have the Medium size of tee shirt?
SQL: SELECT count(member.member_id) FROM major INNER JOIN member ON major.major_id = member.link_to_major WHERE major.major_name = 'Business' AND member.t_shirt_size = 'Medium'
Database: student_club
Note: remaining budget more than 30 USD refers to remaining > 30;
Question: List out the type of events which have remaining budget more than 30 USD.
SQL: SELECT event.type FROM event INNER JOIN budget ON event.event_id = budget.link_to_event WHERE budget.remaining > 30
Database: student_club
Note: held at MU 215 refers to location = 'MU 215';
Question: Mention the category of events which were held at MU 215.
SQL: SELECT budget.category FROM event INNER JOIN budget ON event.event_id = budget.link_to_event WHERE event.location = 'MU 215'
Database: student_club
Note: taken place in 2020-03-24T12:00:00 refers to event_date = '2020-03-24T12:00:00';
Question: What is the category of event which was taken place in 2020-03-24T12:00:00?
SQL: SELECT budget.category FROM event INNER JOIN budget ON event.event_id = budget.link_to_event WHERE event.event_date = '2020-03-24T12:00:00'
Database: student_club
Note: name of major refers to major_name; 'Vice President' is position of Student Club;
Question: State the name of major that Vice President has joined.
SQL: SELECT major.major_name FROM major INNER JOIN member ON major.major_id = member.link_to_major WHERE member.position = 'Vice President'
Database: student_club
Note: DIVIDE(SUM(position = 'member' and major_name = 'Business'), COUNT(member_id)) * 100;
Question: Calculate the percentage of members who are major Business in the list?
SQL: SELECT cast(sum(CASE WHEN major.major_name = 'Business' THEN 1 ELSE 0 END) AS REAL) * 100 / count(member.member_id) FROM member INNER JOIN major ON major.major_id = member.link_to_major WHERE member.position = 'Member'
Database: student_club
Note: 'MU 215' is the location of event;
Question: State the category of events were held at MU 215.
SQL: SELECT DISTINCT budget.category FROM event INNER JOIN budget ON event.event_id = budget.link_to_event WHERE event.location = 'MU 215'
Database: student_club
Note: amount of 50 refers to amount = 50;
Question: How many income are received with an amount of 50?
SQL: SELECT count(income_id) FROM income WHERE amount = 50
Database: student_club
Note: among the members refers to position = 'member'; extra large t-shirt size refers to t_shirt_size = 'X-Large';
Question: Among the members, how many of them have an extra large t-shirt size?
SQL: SELECT count(member_id) FROM member WHERE POSITION = 'Member' AND t_shirt_size = 'X-Large'
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
Note: 'Environmental Engineering' is the major_name;
Question: List the last name of members with a major in environmental engineering and include its department and college name.
SQL: SELECT member.last_name, major.department, major.college FROM major INNER JOIN member ON major.major_id = member.link_to_major WHERE member.position = 'Member' AND major.major_name = 'Environmental Engineering'
Database: student_club
Note: budget category refers to category; events located at refers to location; type = 'Guest Speaker'; 0 budget spent refers to spent = 0;
Question: What are the budget category of the events located at MU 215 and a guest speaker type with a 0 budget spent?
SQL: SELECT DISTINCT budget.category, event.type FROM event INNER JOIN budget ON event.event_id = budget.link_to_event WHERE event.location = 'MU 215' AND budget.spent = 0 AND event.type = 'Guest Speaker'
Database: student_club
Note: 'Electrical and Computer Engineering department' is the department; members enrolled refers to position = 'member';
Question: List the city and state of members enrolled under electrical and computer engineering department.
SQL: SELECT city, state FROM member INNER JOIN major ON major.major_id = member.link_to_major INNER JOIN zip_code ON zip_code.zip_code = member.zip WHERE department = 'Electrical and Computer Engineering Department' AND POSITION = 'Member'
Database: student_club
Note: name of social event refers to event_name where type = 'Social'; 'Vice President' is position; located at refers to location;
Question: What is the name of the social event that was attended by the vice president of the Student_Club located at 900 E. Washington St.?
SQL: SELECT event.event_name FROM attendance INNER JOIN event ON event.event_id = attendance.link_to_event INNER JOIN member ON attendance.link_to_member = member.member_id WHERE member.position = 'Vice President' AND event.location = '900 E. Washington St.' AND event.type = 'Social'
Database: student_club
Note: bought pizza on 09/10/2019 refers to expense_description = 'Pizza' where expense_date = '2019-09-10';
Question: What is the last name and position of the student that bought pizza on 09/10/2019?
SQL: SELECT member.last_name, member.position FROM member INNER JOIN expense ON member.member_id = expense.link_to_member WHERE expense.expense_date = '2019-09-10' AND expense.expense_description = 'Pizza'
Database: student_club
Note: members of the club refers to position = 'member'; 'Women's Soccer' is event name;
Question: List the last name of the members of the club that attended the women's soccer event.
SQL: SELECT member.last_name FROM attendance INNER JOIN event ON event.event_id = attendance.link_to_event INNER JOIN member ON attendance.link_to_member = member.member_id WHERE event.event_name = 'Women''s Soccer' AND member.position = 'Member'
Database: student_club
Note: t_shirt_size = 'Medium' where position = 'member'; percentage = DIVIDE(COUNT(amount = 50), COUNT(member_id)) * 100;
Question: Among the members with t-shirt size of medium, what is the percentage of the amount 50 received by the Student_Club?
SQL: SELECT cast(sum(CASE WHEN income.amount = 50 THEN 1.0 ELSE 0 END) AS REAL) * 100 / count(income.income_id) FROM member INNER JOIN income ON member.member_id = income.link_to_member WHERE member.position = 'Member' AND member.t_shirt_size = 'Medium'
Database: student_club
Note: zip codes that have post office boxes refers to type = 'PO Box';
Question: Which countries have zip codes with post office boxes?
SQL: SELECT DISTINCT county FROM zip_code WHERE TYPE = 'PO Box' AND county IS NOT NULL
Database: student_club
Note: zip codes that have post office boxes refers to type = 'PO Box';
Question: What are the zip codes that have post office boxes in the country of the country of San Juan Municipio whose state is Puerto Rico?
SQL: SELECT zip_code FROM zip_code WHERE TYPE = 'PO Box' AND county = 'San Juan Municipio' AND state = 'Puerto Rico'
Database: student_club
Note: 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';
Question: List the names of closed event as "game" that was closed from 3/15/2019 to 3/20/2020.
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
Note: have paid more than 50 dollar refers to cost > 50;
Question: Please provide links to events for members who have paid more than 50 dollar.
SQL: SELECT DISTINCT attendance.link_to_event FROM expense INNER JOIN member ON expense.link_to_member = member.member_id INNER JOIN attendance ON member.member_id = attendance.link_to_member WHERE expense.cost > 50
Database: student_club
Note: approved from 1/10/2019 to 11/19/2019 refers to approved = 'true' and expense_date BETWEEN '2019-01-10' and '2019-11-19';
Question: Which members who were approved from 1/10/2019 to 11/19/2019? Please identify the member who attended the event and the link to their event.
SQL: SELECT DISTINCT expense.link_to_member, attendance.link_to_event FROM expense INNER JOIN member ON expense.link_to_member = member.member_id INNER JOIN attendance ON member.member_id = attendance.link_to_member WHERE date(substr(expense.expense_date, 1, 10)) BETWEEN '2019-01-10' AND '2019-11-19' AND expense.approved = 'true'
Database: student_club
Question: Please indicate the college of the person whose first name is Katy with the link to the major "rec1N0upiVLy5esTO".
SQL: SELECT major.college FROM member INNER JOIN major ON major.major_id = member.link_to_major WHERE member.link_to_major = 'rec1N0upiVLy5esTO' AND member.first_name = 'Katy'
Database: student_club
Note: 'college of Agriculture and Applied Sciences' is the college; majored in business refers to major_name = 'Business'; phone numbers refers to phone;
Question: Please list the phone numbers of the members who majored in business at the College of Agriculture and Applied Sciences.
SQL: SELECT member.phone FROM member INNER JOIN major ON major.major_id = member.link_to_major WHERE major.major_name = 'Business' AND major.college = 'College of Agriculture and Applied Sciences'
Database: student_club
Note: expense_date BETWEEN '2019-09-10' and '2019-11-19'; cost > 20;
Question: List emails of people who paid more than 20 dollars from 9/10/2019 to 11/19/2019.
SQL: SELECT DISTINCT member.email FROM member INNER JOIN expense ON member.member_id = expense.link_to_member WHERE date(substr(expense.expense_date, 1, 10)) BETWEEN '2019-09-10' AND '2019-11-19' AND expense.cost > 20
Database: student_club
Note: 'education' is the major name; 'member' is a position of club;
Question: How many members have education major in the College of Education & Human Services?
SQL: SELECT count(member.member_id) FROM member INNER JOIN major ON major.major_id = member.link_to_major WHERE member.position = 'Member' AND major.major_name LIKE '%Education%' AND major.college = 'College of Education & Human Services'
Database: student_club
Note: went over budget refers to remaining < 0; percentage = DIVIDE(SUM(remaining < 0), COUNT(event_id)) * 100;
Question: What is the percentage of the events that went over budget?
SQL: SELECT cast(sum(CASE WHEN remaining < 0 THEN 1 ELSE 0 END) AS REAL) * 100 / count(budget_id) FROM budget
Database: student_club
Note: event_date BETWEEN '2019-11-01' and '2020-03-31';
Question: Give the event ID, location, and status of events conducted from November 2019 to March 2020.
SQL: SELECT event_id, LOCATION, status FROM event WHERE date(substr(event_date, 1, 10)) BETWEEN '2019-11-01' AND '2020-03-31'
Database: student_club
Note: expense refers to expense_description; spend more than fifty dollars on average refers to DIVIDE( SUM(cost), COUNT(expense_id) ) > 50;
Question: List the expenses that spend more than fifty dollars on average.
SQL: SELECT expense_description FROM expense GROUP BY expense_description HAVING avg(cost) > 50
Database: student_club
Note: full name refers to first_name, last_name; t_shirt_size = 'X-Large';
Question: Find the full name of members whose t-shirt size is extra large.
SQL: SELECT first_name, last_name FROM member WHERE t_shirt_size = 'X-Large'
Database: student_club
Note: DIVIDE(SUM(type = 'PO Box'), COUNT(zip_code)) * 100;
Question: Calculate the percentage of zip codes that are PO boxes.
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
Note: name of event refers to event_name; underspend its budget refers to remaining > 0;
Question: List the name and location of events that underspend its budget.
SQL: SELECT DISTINCT event.event_name, event.location FROM event INNER JOIN budget ON event.event_id = budget.link_to_event WHERE budget.remaining > 0
Database: student_club
Note: name of event refers to event_name; date of event refers to event_date; expenses for pizza refers to expense_description = 'Pizza' where cost > 50 and cost < 100;
Question: Find the name and date of events with expenses for pizza that were more than fifty dollars but less than a hundred dollars.
SQL: SELECT event.event_name, event.event_date FROM event INNER JOIN budget ON event.event_id = budget.link_to_event INNER JOIN expense ON budget.budget_id = expense.link_to_budget WHERE expense.expense_description = 'Pizza' AND expense.cost > 50 AND expense.cost < 100
Database: student_club
Note: full name refers to first_name, last_name; major of members refers to major_name; spend more than a hundred dollars on an expense refers to cost > 100;
Question: What is the name and major of members who had to spend more than a hundred dollars on an expense?
SQL: SELECT DISTINCT member.first_name, member.last_name, major.major_name FROM member INNER JOIN major ON major.major_id = member.link_to_major INNER JOIN expense ON member.member_id = expense.link_to_member WHERE expense.cost > 100
Database: student_club
Note: more than fifty incomes refers to income > 40;
Question: In the events with more than forty incomes, list the city and country in which the event is happening.
SQL: SELECT DISTINCT zip_code.city, zip_code.county FROM income INNER JOIN member ON income.link_to_member = member.member_id INNER JOIN zip_code ON zip_code.zip_code = member.zip WHERE income.amount > 40
Database: student_club
Note: paid the most amount refers to for expense incurred in more than one event refers to MAX(cost where COUNT(event_id) > 1);
Question: Among the members who incurred expenses in more than one event, who paid the most amount?
SQL: SELECT member.member_id FROM expense INNER JOIN member ON expense.link_to_member = member.member_id INNER JOIN budget ON expense.link_to_budget = budget.budget_id INNER JOIN event ON budget.link_to_event = event.event_id GROUP BY member.member_id HAVING count(DISTINCT event.event_id) > 1 ORDER BY sum(expense.cost) DESC LIMIT 1
Database: student_club
Note: position other than a member refers to position ! = 'member'; average amount paid = DIVIDE( SUM(cost), COUNT(event_id));
Question: What is the average amount paid by students in a position other than a member?
SQL: SELECT avg(expense.cost) FROM expense INNER JOIN member ON expense.link_to_member = member.member_id WHERE member.position != 'Member'
Database: student_club
Note: name of events refers to event_name; less than average parking cost refers to cost < DIVIDE(SUM(cost), COUNT(event_id)) where category = 'Parking';
Question: List the name of events with less than average parking cost.
SQL: SELECT event.event_name FROM event INNER JOIN budget ON event.event_id = budget.link_to_event INNER JOIN expense ON budget.budget_id = expense.link_to_budget WHERE budget.category = 'Parking' AND expense.cost < (SELECT avg(cost) FROM expense)
Database: student_club
Note: meeting events refers to type = 'Meeting'; percentage = DIVIDE( SUM(cost), COUNT(event_id)) * 100;
Question: What is the percentage of the cost for the meeting events?
SQL: SELECT sum(CASE WHEN event.type = 'Meeting' THEN expense.cost ELSE 0 END) * 100 / sum(expense.cost) FROM event INNER JOIN budget ON event.event_id = budget.link_to_event INNER JOIN expense ON budget.budget_id = expense.link_to_budget
Database: student_club
Note: budget allowed refers to expense_description; expense_description = 'Water, chips, cookies'; most money refers to MAX(cost);
Question: Which budget allowed the most money for water, chips, and cookies?
SQL: SELECT budget.budget_id FROM expense INNER JOIN budget ON expense.link_to_budget = budget.budget_id WHERE expense.expense_description = 'Water, chips, cookies' ORDER BY expense.cost DESC LIMIT 1
Database: student_club
Note: full name refers to first_name, last_name; spend the most money refers to MAX(expense.cost);
Question: List the full name of the top five members who spend the most money in the descending order of spending.
SQL: SELECT member.first_name, member.last_name FROM expense INNER JOIN budget ON expense.link_to_budget = budget.budget_id INNER JOIN member ON expense.link_to_member = member.member_id ORDER BY budget.spent DESC LIMIT 5
Database: student_club
Note: 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);
Question: Give the full name and contact number of members who had to spend more than average on each expense.
SQL: SELECT DISTINCT member.first_name, member.last_name, member.phone FROM expense INNER JOIN budget ON expense.link_to_budget = budget.budget_id INNER JOIN member ON member.member_id = expense.link_to_member WHERE expense.cost > ( SELECT avg(expense.cost) FROM expense INNER JOIN budget ON expense.link_to_budget = budget.budget_id INNER JOIN member ON member.member_id = expense.link_to_member )
Database: student_club
Note: SUBTRACT( DIVIDE( SUM(state = 'New Jersey'), COUNT(position = 'member')), DIVIDE( SUM(state = 'Vermont'), COUNT(position = 'member')) );
Question: Calculate the difference in the percentage of members in New Jersey and Vermont.
SQL: SELECT cast((sum(CASE WHEN zip_code.state = 'New Jersey' THEN 1 ELSE 0 END) - sum(CASE WHEN zip_code.state = 'Vermont' THEN 1 ELSE 0 END)) AS REAL) * 100 / count(member.member_id) AS diff FROM member INNER JOIN zip_code ON zip_code.zip_code = member.zip
Database: student_club
Note: major refers to major name;
Question: What is the major of Garrett Gerke and which department does it belong to?
SQL: SELECT major.major_name, major.department FROM member INNER JOIN major ON major.major_id = member.link_to_major WHERE member.first_name = 'Garrett' AND member.last_name = 'Gerke'
Database: student_club
Note: full name refers to first_name, last name; spent money for refers expense description; expense_description = 'Water, Veggie tray, supplies';
Question: Write the full name of the member who spent money for water, veggie tray and supplies and include the cost of it.
SQL: SELECT member.first_name, member.last_name, expense.cost FROM expense INNER JOIN member ON expense.link_to_member = member.member_id WHERE expense.expense_description = 'Water, Veggie tray, supplies'
Database: student_club
Note: 'Elementary Education' is the major name; phone numbers refers to phone;
Question: List the last names of students under the Elementary Education major and include their phone numbers.
SQL: SELECT member.last_name, member.phone FROM member INNER JOIN major ON major.major_id = member.link_to_major WHERE major.major_name = 'Elementary Education'
Database: student_club
Note: amount budgeted refers to amount, 'January Speaker' is the event name;
Question: What category was budgeted for the 'January Speaker' event and how much was the amount budgeted for that category?
SQL: SELECT budget.category, budget.amount FROM event INNER JOIN budget ON event.event_id = budget.link_to_event WHERE event.event_name = 'January Speaker'
Database: student_club
Note: budgeted for food refers to category = 'Food';
Question: List the event names which were budgeted for the food.
SQL: SELECT event.event_name FROM event INNER JOIN budget ON event.event_id = budget.link_to_event WHERE budget.category = 'Food'
Database: student_club
Note: full name refers to first_name, last_name, amount of funds received refers to amount, received funds on date refers to date_received;
Question: Write the full names of students who received funds on the date of 9/9/2019 and include the amount received.
SQL: SELECT DISTINCT member.first_name, member.last_name, income.amount FROM event INNER JOIN attendance ON event.event_id = attendance.link_to_event INNER JOIN member ON member.member_id = attendance.link_to_member INNER JOIN income ON income.link_to_member = member.member_id WHERE income.date_received = '2019-09-09'
Database: student_club
Note: 'Posters' refers to expense description;
Question: Which budget category does the expense 'Posters' fall to?
SQL: SELECT DISTINCT budget.category FROM expense INNER JOIN budget ON expense.link_to_budget = budget.budget_id WHERE expense.expense_description = 'Posters'
Database: student_club
Note: full name refers to first_name, last name;
Question: Write the full name of the club member with the position of 'Secretary' and list which college the club member belongs to.
SQL: SELECT member.first_name, member.last_name, college FROM member INNER JOIN major ON major.major_id = member.link_to_major WHERE member.position = 'Secretary'
Database: student_club
Note: total amount spent = SUM(spent) where category = 'Speaker Gifts';
Question: Calculate the total amount spent on speaker gifts and list the name of the event they were spent on.
SQL: SELECT sum(budget.spent), event.event_name FROM budget INNER JOIN event ON budget.link_to_event = event.event_id WHERE budget.category = 'Speaker Gifts' GROUP BY event.event_name
Database: student_club
Note: hometown refers to city;
Question: Where is the hometown of Garrett Gerke?
SQL: SELECT zip_code.city FROM member INNER JOIN zip_code ON zip_code.zip_code = member.zip WHERE member.first_name = 'Garrett' AND member.last_name = 'Gerke'
Database: student_club
Note: full name refers to first_name, last_name, hometown of Lincolnton, North Carolina refers to city = 'Lincolnton' AND state = 'North Carolina';
Question: Which student has the hometown of Lincolnton, North Carolina with the zip code of 28092? List their full name and position.
SQL: SELECT member.first_name, member.last_name, member.position FROM member INNER JOIN zip_code ON zip_code.zip_code = member.zip WHERE zip_code.city = 'Lincolnton' AND zip_code.state = 'North Carolina' AND zip_code.zip_code = 28092
Database: debit_card_specializing
Question: How many gas stations in CZE has Premium gas?
SQL: SELECT count(gasstationid) FROM gasstations WHERE country = 'CZE' AND SEGMENT = 'Premium'
Database: debit_card_specializing
Note: ratio of customers who pay in EUR against customers who pay in CZK = count(currency = 'EUR') / count(currency = 'CZK').;
Question: What is the ratio of customers who pay in EUR against customers who pay in CZK?
SQL: SELECT cast(sum(iif(currency = 'EUR', 1, 0)) AS FLOAT) / sum(iif(currency = 'CZK', 1, 0)) AS ratio FROM customers