question_id
stringlengths
1
4
db_id
stringclasses
11 values
question
stringlengths
23
286
evidence
stringlengths
0
591
sql
stringlengths
29
1.45k
difficulty
stringclasses
3 values
1400
student_club
Among all events hold by the Student_Club in 2019, find the percentage share of events related to 'Community Service'
DIVIDE(SUM(type = 'Community Service'), COUNT(event_id)) * 100 where event_date BETWEEN' 2019-01-01' and '2019-12-31'
SELECT CAST(SUM(CASE WHEN type = 'Community Service' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(type) FROM event WHERE SUBSTR(event_date, 1, 4) = '2019'
moderate
1401
student_club
Indicate the cost of posters for 'September Speaker' event.
'Posters' is the expense description; 'September Speaker' is an event name
SELECT T3.cost FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event INNER JOIN expense AS T3 ON T2.budget_id = T3.link_to_budget WHERE T1.event_name = 'September Speaker' AND T3.expense_description = 'Posters'
moderate
1402
student_club
What is the most popular size of t-shirt ordered by the club members?
most popular size of t-shirt ordered refers to MAX(COUNT(t_shirt_size))
SELECT t_shirt_size FROM member GROUP BY t_shirt_size ORDER BY COUNT(t_shirt_size) DESC LIMIT 1
simple
1403
student_club
Indicate the name of the closed event whose cost has exceeded the budget the most.
closed events refers to event_name where status = 'Closed'; exceed the budget the most refers to MIN(remaining) where remaining < 0
SELECT T2.event_name FROM budget AS T1 INNER JOIN event AS T2 ON T2.event_id = T1.link_to_event WHERE T1.event_status = 'Closed' AND T1.remaining < 0 ORDER BY T1.remaining LIMIT 1
moderate
1404
student_club
Identify the type of expenses and their total value approved for 'October Meeting' event.
total value refers to SUM(cost); 'October Meeting' is an event name;
SELECT T1.type, SUM(T3.cost) FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event INNER JOIN expense AS T3 ON T2.budget_id = T3.link_to_budget WHERE T1.event_name = 'October Meeting'
moderate
1405
student_club
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.
'April Speaker' is an event name; amount budgeted refers to SUM(amount); budget categories refers to category
SELECT T2.category, SUM(T2.amount) FROM event AS T1 JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.event_name = 'April Speaker' GROUP BY T2.category ORDER BY SUM(T2.amount) ASC
moderate
1406
student_club
Among the budgets for Food, which one has the highest budgeted amount?
MAX(amount) where category = 'Food'
SELECT budget_id FROM budget WHERE category = 'Food' AND amount = ( SELECT MAX(amount) FROM budget )
simple
1407
student_club
Among the budgets for Advertising, list out top three which have the most budgeted amount?
MAX(amount) where category = 'Advertisement'
SELECT budget_id FROM budget WHERE category = 'Advertisement' ORDER BY amount DESC LIMIT 3
simple
1408
student_club
Calculate the total cost spent for Parking in the list.
total cost spent for Parking refers to SUM(cost) where expense_description = 'Parking'
SELECT SUM(cost) FROM expense WHERE expense_description = 'Parking'
simple
1409
student_club
Mention the total expense used on 8/20/2019.
total expense refers SUM(cost) where expense_date = '2019-08-20'
SELECT SUM(cost) FROM expense WHERE expense_date = '2019-08-20'
simple
1410
student_club
List out the full name and total cost that member id "rec4BLdZHS2Blfp4v" incurred?
full name refers to first_name, last name
SELECT T1.first_name, T1.last_name, SUM(T2.cost) FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T1.member_id = 'rec4BLdZHS2Blfp4v'
simple
1411
student_club
State what kind of expenses that Sacha Harrison incurred?
kind of expenses refers to expense_description; Sacha Harrison is the full name; full name refers to first_name, last_name;
SELECT T2.expense_description FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T1.first_name = 'Sacha' AND T1.last_name = 'Harrison'
simple
1412
student_club
What kind of expenses incurred by members who have X-Large in size of tee shirt?
kind of expenses refers to expense_description; t_shirt_size = 'X-Large'
SELECT T2.expense_description FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T1.t_shirt_size = 'X-Large'
simple
1413
student_club
Mention the zip code of member who incurred less than 50USD.
incurred less than 50USD refers to cost < 50
SELECT T1.zip FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T2.cost < 50
simple
1414
student_club
State the name of major that Phillip Cullen has joined.
name of major refers to major_name
SELECT T1.major_name FROM major AS T1 INNER JOIN member AS T2 ON T1.major_id = T2.link_to_major WHERE T2.first_name = 'Phillip' AND T2.last_name = 'Cullen'
simple
1415
student_club
List out the position of members who joined major of Business.
'Business' is the major name
SELECT T2.position FROM major AS T1 INNER JOIN member AS T2 ON T1.major_id = T2.link_to_major WHERE T1.major_name = 'Business'
simple
1416
student_club
How many members of Business have the Medium size of tee shirt?
members of Economics refers to major_name = 'Business'; t_shirt_size = 'Medium'
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 = 'Business' AND T2.t_shirt_size = 'Medium'
simple
1417
student_club
List out the type of events which have remaining budget more than 30 USD.
remaining budget more than 30 USD refers to remaining > 30
SELECT T1.type FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T2.remaining > 30
simple
1418
student_club
Mention the category of events which were held at MU 215.
held at MU 215 refers to location = 'MU 215'
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'
simple
1419
student_club
What is the category of event which was taken place in 2020-03-24T12:00:00?
taken place in 2020-03-24T12:00:00 refers to event_date = '2020-03-24T12:00:00'
SELECT T2.category FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.event_date = '2020-03-24T12:00:00'
simple
1420
student_club
State the name of major that Vice President has joined.
name of major refers to major_name; 'Vice President' is position of Student Club
SELECT T1.major_name FROM major AS T1 INNER JOIN member AS T2 ON T1.major_id = T2.link_to_major WHERE T2.position = 'Vice President'
simple
1421
student_club
Calculate the percentage of members who are major Business in the list?
DIVIDE(SUM(position = 'Member' and major_name = 'Business'), COUNT(member_id)) * 100
SELECT CAST(SUM(CASE WHEN T2.major_name = 'Business' 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'
moderate
1422
student_club
State the category of events were held at MU 215.
'MU 215' is the location of event;
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'
simple
1423
student_club
How many income are received with an amount of 50?
amount of 50 refers to amount = 50
SELECT COUNT(income_id) FROM income WHERE amount = 50
simple
1424
student_club
Among the members, how many of them have an extra large t-shirt size?
among the members refers to position = 'Member'; extra large t-shirt size refers to t_shirt_size = 'X-Large'
SELECT COUNT(member_id) FROM member WHERE position = 'Member' AND t_shirt_size = 'X-Large'
simple
1425
student_club
In the College of Agriculture and Applied Sciences, how many majors are under the department of School of Applied Sciences, Technology and Education?
SELECT COUNT(major_id) FROM major WHERE department = 'School of Applied Sciences, Technology and Education' AND college = 'College of Agriculture and Applied Sciences'
simple
1426
student_club
List the last name of members with a major in environmental engineering and include its department and college name.
'Environmental Engineering' is the major_name;
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'
moderate
1427
student_club
What are the budget category of the events located at MU 215 and a guest speaker type with a 0 budget spent?
budget category refers to category; events located at refers to location; type = 'Guest Speaker'; 0 budget spent refers to spent = 0;
SELECT DISTINCT T2.category, 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'
moderate
1428
student_club
List the city and state of members enrolled under electrical and computer engineering department.
'Electrical and Computer Engineering Department' is the department; members enrolled refers to position = 'Member'
SELECT city, state FROM member AS T1 INNER JOIN major AS T2 ON T2.major_id = T1.link_to_major INNER JOIN zip_code AS T3 ON T3.zip_code = T1.zip WHERE department = 'Electrical and Computer Engineering Department' AND position = 'Member'
moderate
1429
student_club
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.?
name of social event refers to event_name where type = 'Social'; 'Vice President' is position; located at refers to location
SELECT T2.event_name FROM attendance AS T1 INNER JOIN event AS T2 ON T2.event_id = T1.link_to_event INNER JOIN member AS T3 ON T1.link_to_member = T3.member_id WHERE T3.position = 'Vice President' AND T2.location = '900 E. Washington St.' AND T2.type = 'Social'
challenging
1430
student_club
What is the last name and position of the student that bought pizza on 09/10/2019?
bought pizza on 09/10/2019 refers to expense_description = 'Pizza' where expense_date = '2019-09-10'
SELECT T1.last_name, T1.position FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE T2.expense_date = '2019-09-10' AND T2.expense_description = 'Pizza'
moderate
1431
student_club
List the last name of the members of the club that attended the women's soccer event.
members of the club refers to position = 'Member'; 'Women's Soccer' is event name;
SELECT T3.last_name FROM attendance AS T1 INNER JOIN event AS T2 ON T2.event_id = T1.link_to_event INNER JOIN member AS T3 ON T1.link_to_member = T3.member_id WHERE T2.event_name = 'Women''s Soccer' AND T3.position = 'Member'
moderate
1432
student_club
Among the members with t-shirt size of medium, what is the percentage of the amount 50 received by the Student_Club?
t_shirt_size = 'Medium' where position = 'Member'; percentage = DIVIDE(COUNT(amount = 50), COUNT(member_id)) * 100
SELECT CAST(SUM(CASE WHEN T2.amount = 50 THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(T2.income_id) FROM member AS T1 INNER JOIN income AS T2 ON T1.member_id = T2.link_to_member WHERE T1.position = 'Member' AND T1.t_shirt_size = 'Medium'
moderate
1433
student_club
Which countries have zip codes with post office boxes?
zip codes that have post office boxes refers to type = 'PO Box'
SELECT DISTINCT county FROM zip_code WHERE type = 'PO Box' AND county IS NOT NULL
simple
1434
student_club
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?
zip codes that have post office boxes refers to type = 'PO Box'
SELECT zip_code FROM zip_code WHERE type = 'PO Box' AND county = 'San Juan Municipio' AND state = 'Puerto Rico'
simple
1435
student_club
List the names of closed event as "game" that was closed from 3/15/2019 to 3/20/2020.
name of events refers event_name; game event that was closed refers to type = 'Game' where status = 'Closed'; event_date BETWEEN '2019-03-15' and '2020-03-20';
SELECT DISTINCT event_name FROM event WHERE type = 'Game' AND date(SUBSTR(event_date, 1, 10)) BETWEEN '2019-03-15' AND '2020-03-20' AND status = 'Closed'
moderate
1436
student_club
Please provide links to events for members who have paid more than 50 dollar.
have paid more than 50 dollar refers to cost > 50
SELECT DISTINCT T3.link_to_event FROM expense AS T1 INNER JOIN member AS T2 ON T1.link_to_member = T2.member_id INNER JOIN attendance AS T3 ON T2.member_id = T3.link_to_member WHERE T1.cost > 50
simple
1437
student_club
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.
approved from 1/10/2019 to 11/19/2019 refers to approved = 'true' and expense_date BETWEEN '2019-01-10' and '2019-11-19'
SELECT DISTINCT T1.link_to_member, T3.link_to_event FROM expense AS T1 INNER JOIN member AS T2 ON T1.link_to_member = T2.member_id INNER JOIN attendance AS T3 ON T2.member_id = T3.link_to_member WHERE date(SUBSTR(T1.expense_date, 1, 10)) BETWEEN '2019-01-10' AND '2019-11-19' AND T1.approved = 'true'
challenging
1438
student_club
Please indicate the college of the person whose first name is Katy with the link to the major "rec1N0upiVLy5esTO".
SELECT T2.college FROM member AS T1 INNER JOIN major AS T2 ON T2.major_id = T1.link_to_major WHERE T1.link_to_major = 'rec1N0upiVLy5esTO' AND T1.first_name = 'Katy'
simple
1439
student_club
Please list the phone numbers of the members who majored in business at the College of Agriculture and Applied Sciences.
'College of Agriculture and Applied Sciences' is the college; majored in business refers to major_name = 'Business'; phone numbers refers to phone
SELECT T1.phone FROM member AS T1 INNER JOIN major AS T2 ON T2.major_id = T1.link_to_major WHERE T2.major_name = 'Business' AND T2.college = 'College of Agriculture and Applied Sciences'
moderate
1440
student_club
List emails of people who paid more than 20 dollars from 9/10/2019 to 11/19/2019.
expense_date BETWEEN '2019-09-10' and '2019-11-19'; cost > 20
SELECT DISTINCT T1.email FROM member AS T1 INNER JOIN expense AS T2 ON T1.member_id = T2.link_to_member WHERE date(SUBSTR(T2.expense_date, 1, 10)) BETWEEN '2019-09-10' AND '2019-11-19' AND T2.cost > 20
moderate
1441
student_club
How many members have education major in the College of Education & Human Services?
'education' is the major name; 'Member' is a position of club;
SELECT 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' AND T2.major_name LIKE '%Education%' AND T2.college = 'College of Education & Human Services'
moderate
1442
student_club
What is the percentage of the events that went over budget?
went over budget refers to remaining < 0; percentage = DIVIDE(SUM(remaining < 0), COUNT(event_id)) * 100
SELECT CAST(SUM(CASE WHEN remaining < 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(budget_id) FROM budget
simple
1443
student_club
Give the event ID, location, and status of events conducted from November 2019 to March 2020.
event_date BETWEEN '2019-11-01' and '2020-03-31'
SELECT event_id, location, status FROM event WHERE date(SUBSTR(event_date, 1, 10)) BETWEEN '2019-11-01' AND '2020-03-31'
simple
1444
student_club
List the expenses that spend more than fifty dollars on average.
expense refers to expense_description; spend more than fifty dollars on average refers to DIVIDE( SUM(cost), COUNT(expense_id) ) > 50
SELECT expense_description FROM expense GROUP BY expense_description HAVING AVG(cost) > 50
simple
1445
student_club
Find the full name of members whose t-shirt size is extra large.
full name refers to first_name, last_name; t_shirt_size = 'X-Large'
SELECT first_name, last_name FROM member WHERE t_shirt_size = 'X-Large'
simple
1446
student_club
Calculate the percentage of zip codes that are PO boxes.
DIVIDE(SUM(type = 'PO Box'), COUNT(zip_code)) * 100
SELECT CAST(SUM(CASE WHEN type = 'PO Box' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(zip_code) FROM zip_code
simple
1447
student_club
List the name and location of events that underspend its budget.
name of event refers to event_name; underspend its budget refers to remaining > 0
SELECT DISTINCT T1.event_name, T1.location FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T2.remaining > 0
simple
1448
student_club
Find the name and date of events with expenses for pizza that were more than fifty dollars but less than a hundred dollars.
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
SELECT T1.event_name, T1.event_date 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 T3.expense_description = 'Pizza' AND T3.cost > 50 AND T3.cost < 100
challenging
1449
student_club
What is the name and major of members who had to spend more than a hundred dollars on an expense?
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
SELECT DISTINCT T1.first_name, T1.last_name, T2.major_name FROM member AS T1 INNER JOIN major AS T2 ON T2.major_id = T1.link_to_major INNER JOIN expense AS T3 ON T1.member_id = T3.link_to_member WHERE T3.cost > 100
moderate
1450
student_club
In the events with more than forty incomes, list the city and country in which the event is happening.
more than fifty incomes refers to income > 40
SELECT DISTINCT T3.city, T3.county FROM income AS T1 INNER JOIN member AS T2 ON T1.link_to_member = T2.member_id INNER JOIN zip_code AS T3 ON T3.zip_code = T2.zip WHERE T1.amount > 40
simple
1451
student_club
Among the members who incurred expenses in more than one event, who paid the most amount?
paid the most amount refers to for expense incurred in more than one event refers to MAX(cost where COUNT(event_id) > 1)
SELECT T2.member_id FROM expense AS T1 INNER JOIN member AS T2 ON T1.link_to_member = T2.member_id INNER JOIN budget AS T3 ON T1.link_to_budget = T3.budget_id INNER JOIN event AS T4 ON T3.link_to_event = T4.event_id GROUP BY T2.member_id HAVING COUNT(DISTINCT T4.event_id) > 1 ORDER BY SUM(T1.cost) DESC LIMIT 1
challenging
1452
student_club
What is the average amount paid by students in a position other than a member?
position other than a member refers to position ! = 'Member'; average amount paid = DIVIDE( SUM(cost), COUNT(event_id))
SELECT AVG(T1.cost) FROM expense AS T1 INNER JOIN member as T2 ON T1.link_to_member = T2.member_id WHERE T2.position != 'Member'
moderate
1453
student_club
List the name of events with less than average parking cost.
name of events refers to event_name; less than average parking cost refers to cost < DIVIDE(SUM(cost), COUNT(event_id)) where category = 'Parking'
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 WHERE T2.category = 'Parking' AND T3.cost < (SELECT AVG(cost) FROM expense)
moderate
1454
student_club
What is the percentage of the cost for the meeting events?
meeting events refers to type = 'Meeting'; percentage = DIVIDE( SUM(cost), COUNT(event_id)) * 100
SELECT SUM(CASE WHEN T1.type = 'Meeting' 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
moderate
1455
student_club
Which budget allowed the most money for water, chips, and cookies?
budget allowed refers to expense_description; expense_description = 'Water, chips, cookies'; most money refers to MAX(cost)
SELECT T2.budget_id FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id WHERE T1.expense_description = 'Water, chips, cookies' ORDER BY T1.cost DESC LIMIT 1
moderate
1456
student_club
List the full name of the top five members who spend the most money in the descending order of spending.
full name refers to first_name, last_name; spend the most money refers to MAX(expense.cost)
SELECT T3.first_name, T3.last_name FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id INNER JOIN member AS T3 ON T1.link_to_member = T3.member_id ORDER BY T2.spent DESC LIMIT 5
moderate
1457
student_club
Give the full name and contact number of members who had to spend more than average on each expense.
full name refers to first_name, last_name; contact number refers to phone; had spent more than average on each expense refers to cost > AVG(cost)
SELECT DISTINCT T3.first_name, T3.last_name, T3.phone FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id INNER JOIN member AS T3 ON T3.member_id = T1.link_to_member WHERE T1.cost > ( SELECT AVG(T1.cost) FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id INNER JOIN member AS T3 ON T3.member_id = T1.link_to_member )
challenging
1458
student_club
Calculate the difference in the percentage of members in New Jersey and Vermont.
SUBTRACT( DIVIDE( SUM(state = 'New Jersey'), COUNT(position = 'Member')), DIVIDE( SUM(state = 'Vermont'), COUNT(position = 'Member')) )
SELECT CAST((SUM(CASE WHEN T2.state = 'New Jersey' 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
moderate
1459
student_club
What is the major of Garrett Gerke and which department does it belong to?
major refers to major name;
SELECT T2.major_name, T2.department FROM member AS T1 INNER JOIN major AS T2 ON T2.major_id = T1.link_to_major WHERE T1.first_name = 'Garrett' AND T1.last_name = 'Gerke'
simple
1460
student_club
Write the full name of the member who spent money for water, veggie tray and supplies and include the cost of it.
full name refers to first_name, last name; spent money for refers expense description; expense_description = 'Water, Veggie tray, supplies'
SELECT T2.first_name, T2.last_name, T1.cost FROM expense AS T1 INNER JOIN member AS T2 ON T1.link_to_member = T2.member_id WHERE T1.expense_description = 'Water, Veggie tray, supplies'
challenging
1461
student_club
List the last names of students under the Elementary Education major and include their phone numbers.
'Elementary Education' is the major name; phone numbers refers to phone
SELECT T1.last_name, T1.phone FROM member AS T1 INNER JOIN major AS T2 ON T2.major_id = T1.link_to_major WHERE T2.major_name = 'Elementary Education'
simple
1462
student_club
What category was budgeted for the 'January Speaker' event and how much was the amount budgeted for that category?
amount budgeted refers to amount, 'January Speaker' is the event name;
SELECT T2.category, T2.amount FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.event_name = 'January Speaker'
simple
1463
student_club
List the event names which were budgeted for the food.
budgeted for food refers to category = 'Food'
SELECT T1.event_name FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T2.category = 'Food'
simple
1464
student_club
Write the full names of students who received funds on the date of 9/9/2019 and include the amount received.
full name refers to first_name, last_name, amount of funds received refers to amount, received funds on date refers to date_received
SELECT 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'
challenging
1465
student_club
Which budget category does the expense 'Posters' fall to?
'Posters' refers to expense description
SELECT DISTINCT T2.category FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id WHERE T1.expense_description = 'Posters'
simple
1466
student_club
Write the full name of the club member with the position of 'Secretary' and list which college the club member belongs to.
full name refers to first_name, last name
SELECT T1.first_name, T1.last_name, college FROM member AS T1 INNER JOIN major AS T2 ON T2.major_id = T1.link_to_major WHERE T1.position = 'Secretary'
simple
1467
student_club
Calculate the total amount spent on speaker gifts and list the name of the event they were spent on.
total amount spent = SUM(spent) where category = 'Speaker Gifts'
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' GROUP BY T2.event_name
simple
1468
student_club
Where is the hometown of Garrett Gerke?
hometown refers to city
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'
simple
1469
student_club
Which student has the hometown of Lincolnton, North Carolina with the zip code of 28092? List their full name and position.
full name refers to first_name, last_name, hometown of Lincolnton, North Carolina refers to city = 'Lincolnton' AND state = 'North Carolina'
SELECT T1.first_name, T1.last_name, T1.position FROM member AS T1 INNER JOIN zip_code AS T2 ON T2.zip_code = T1.zip WHERE T2.city = 'Lincolnton' AND T2.state = 'North Carolina' AND T2.zip_code = 28092
moderate
1470
debit_card_specializing
How many gas stations in CZE has Premium gas?
SELECT COUNT(GasStationID) FROM gasstations WHERE Country = 'CZE' AND Segment = 'Premium'
simple
1471
debit_card_specializing
What is the ratio of customers who pay in EUR against customers who pay in CZK?
ratio of customers who pay in EUR against customers who pay in CZK = count(Currency = 'EUR') / count(Currency = 'CZK').
SELECT CAST(SUM(IIF(Currency = 'EUR', 1, 0)) AS FLOAT) / SUM(IIF(Currency = 'CZK', 1, 0)) AS ratio FROM customers
simple
1472
debit_card_specializing
In 2012, who had the least consumption in LAM?
Year 2012 can be presented as Between 201201 And 201212; The first 4 strings of the Date values in the yearmonth table can represent year.
SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'LAM' AND SUBSTR(T2.Date, 1, 4) = '2012' GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) ASC LIMIT 1
moderate
1473
debit_card_specializing
What was the average monthly consumption of customers in SME for the year 2013?
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.
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'
moderate
1474
debit_card_specializing
Which customers, paying in CZK, consumed the most gas in 2011?
Year 2011 can be presented as Between 201101 And 201112, which means between January and December in 2011
SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'CZK' AND T2.Date BETWEEN 201101 AND 201112 GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) DESC LIMIT 1
moderate
1475
debit_card_specializing
How many customers in KAM had a consumption of less than 30,000 for the year 2012?
Year 2012 can be presented as Between 201201 And 201212, which means between January and December in 2012
SELECT COUNT(*) FROM ( SELECT T2.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'KAM' AND SUBSTRING(T2.Date, 1, 4) = '2012' GROUP BY T2.CustomerID HAVING SUM(T2.Consumption) < 30000 ) AS t1
moderate
1476
debit_card_specializing
What was the difference in gas consumption between CZK-paying customers and EUR-paying customers in 2012?
Year 2012 can be presented as Between 201201 And 201212; The first 4 strings of the Date values in the yearmonth table can represent year; Difference in Consumption = CZK customers consumption in 2012 - EUR customers consumption in 2012
SELECT SUM(IIF(T1.Currency = 'CZK', T2.Consumption, 0)) - SUM(IIF(T1.Currency = 'EUR', T2.Consumption, 0)) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTR(T2.Date, 1, 4) = '2012'
challenging
1477
debit_card_specializing
Which year recorded the most gas use paid in EUR?
SELECT SUBSTRING(T2.Date, 1, 4) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'EUR' GROUP BY SUBSTRING(T2.Date, 1, 4) ORDER BY SUM(T2.Consumption) DESC LIMIT 1
simple
1478
debit_card_specializing
Which segment had the least consumption?
SELECT T1.Segment FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID GROUP BY T1.Segment ORDER BY SUM(T2.Consumption) ASC LIMIT 1
simple
1479
debit_card_specializing
Which year recorded the most consumption of gas paid in CZK?
The first 4 strings of the Date values in the yearmonth table can represent year.
SELECT SUBSTR(T2.Date, 1, 4) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'CZK' GROUP BY SUBSTR(T2.Date, 1, 4) ORDER BY SUM(T2.Consumption) DESC LIMIT 1
moderate
1480
debit_card_specializing
What was the gas consumption peak month for SME customers in 2013?
Year 2013 can be presented as Between 201301 And 201312; The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month.
SELECT SUBSTR(T2.Date, 5, 2) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTR(T2.Date, 1, 4) = '2013' AND T1.Segment = 'SME' GROUP BY SUBSTR(T2.Date, 5, 2) ORDER BY SUM(T2.Consumption) DESC LIMIT 1
moderate
1481
debit_card_specializing
What is the difference in the annual average consumption of the customers with the least amount of consumption paid in CZK for 2013 between SME and LAM, LAM and KAM, and KAM and SME?
annual average consumption of customer with the lowest consumption in each segment = total consumption per year / the number of customer with lowest consumption in each segment; Difference in annual average = SME's annual average - LAM's annual average; Difference in annual average = LAM's annual average - KAM's annual 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.
SELECT CAST(SUM(IIF(T1.Segment = 'SME', T2.Consumption, 0)) AS REAL) / COUNT(T1.CustomerID) - CAST(SUM(IIF(T1.Segment = 'LAM', T2.Consumption, 0)) AS REAL) / COUNT(T1.CustomerID) , CAST(SUM(IIF(T1.Segment = 'LAM', T2.Consumption, 0)) AS REAL) / COUNT(T1.CustomerID) - CAST(SUM(IIF(T1.Segment = 'KAM', T2.Consumption, 0)) AS REAL) / COUNT(T1.CustomerID) , CAST(SUM(IIF(T1.Segment = 'KAM', T2.Consumption, 0)) AS REAL) / COUNT(T1.CustomerID) - CAST(SUM(IIF(T1.Segment = 'SME', T2.Consumption, 0)) AS REAL) / 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
challenging
1482
debit_card_specializing
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?
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
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
challenging
1483
debit_card_specializing
How much did customer 6 consume in total between August and November 2013?
Between August And November 2013 refers to Between 201308 And 201311; The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month.
SELECT SUM(Consumption) FROM yearmonth WHERE CustomerID = 6 AND Date BETWEEN '201308' AND '201311'
simple
1484
debit_card_specializing
How many more "discount" gas stations does the Czech Republic have compared to Slovakia?
Czech Republic can be represented as the Country value in gasstations table is 'CZE'; Slovakia can be represented as the Country value in the gasstations table is 'SVK'; Computation of more "discount" gas stations= Total no. of discount gas stations in Czech Republic - Total no. of discount gas stations in Slovakia
SELECT SUM(IIF(Country = 'CZE', 1, 0)) - SUM(IIF(Country = 'SVK', 1, 0)) FROM gasstations WHERE Segment = 'Discount'
simple
1485
debit_card_specializing
How much more was customer 7 consuming in April 2013 than customer 5?
April 2013 refers to 201304 in the yearmonth.date
SELECT SUM(IIF(CustomerID = 7, Consumption, 0)) - SUM(IIF(CustomerID = 5, Consumption, 0)) FROM yearmonth WHERE Date = '201304'
simple
1486
debit_card_specializing
Is it true that more SMEs pay in Czech koruna than in euros? If so, how many more?
Amount of more SMEs = Total of SMEs pay using Currency CZK - Total of SMEs pay using Currency EUR
SELECT SUM(Currency = 'CZK') - SUM(Currency = 'EUR') FROM customers WHERE Segment = 'SME'
simple
1487
debit_card_specializing
Which LAM customer used the Euro as their currency and had the highest consumption in October 2013?
October 2013 refers to 201310 in the yearmonth.date
SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'LAM' AND T2.Date = '201310' AND T1.Currency = 'EUR' GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) DESC LIMIT 1
moderate
1488
debit_card_specializing
Who among KAM's customers consumed the most? How much did it consume?
SELECT T2.CustomerID, SUM(T2.Consumption) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'KAM' GROUP BY T2.CustomerID ORDER BY SUM(T2.Consumption) DESC LIMIT 1
simple
1489
debit_card_specializing
How much did the KAM customers consume in total in May 2013?
May 2013 refers to yearmonth.date = 201305
SELECT SUM(T2.Consumption) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Date = '201305' AND T1.Segment = 'KAM'
simple
1490
debit_card_specializing
How many percent of LAM customer consumed more than 46.73?
Percentage of LAM customer consumed more than 46.73 = (Total no. of LAM customers who consumed more than 46.73 / Total no. of LAM customers) * 100.
SELECT CAST(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'
moderate
1491
debit_card_specializing
Which country has more "value for money" gas stations? Please give a total number of "value for money" gas stations in each country.
SELECT Country , ( SELECT COUNT(GasStationID) FROM gasstations WHERE Segment = 'Value for money' ) FROM gasstations WHERE Segment = 'Value for money' GROUP BY Country ORDER BY COUNT(GasStationID) DESC LIMIT 1
simple
1492
debit_card_specializing
What percentage of KAM customers pay in euros?
Percentage of KAM uses Euro = (Total of KAM uses Euro / Total of KAM) * 100%.
SELECT CAST(SUM(Currency = 'EUR') AS FLOAT) * 100 / COUNT(CustomerID) FROM customers WHERE Segment = 'KAM'
simple
1493
debit_card_specializing
In February 2012, what percentage of customers consumed more than 528.3?
February 2012 refers to '201202' in yearmonth.date; The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month.
SELECT CAST(SUM(IIF(Consumption > 528.3, 1, 0)) AS FLOAT) * 100 / COUNT(CustomerID) FROM yearmonth WHERE Date = '201202'
simple
1494
debit_card_specializing
What percentage of Slovakian gas stations are premium?
Percentage of premium gas station = (Total of premium gas station in Slovakia / Total of gas station in Slovakia) * 100%.
SELECT CAST(SUM(IIF(Segment = 'Premium', 1, 0)) AS FLOAT) * 100 / COUNT(GasStationID) FROM gasstations WHERE Country = 'SVK'
simple
1495
debit_card_specializing
Which client ID consumed the most in September 2013?
September 2013 refers to yearmonth.date = '201309'
SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Date = '201309' GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) DESC LIMIT 1
simple
1496
debit_card_specializing
Which client segment consumed the least in September 2013?
September 2013 refers to yearmonth.date = '201309'
SELECT T1.Segment FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Date = '201309' GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) ASC LIMIT 1
simple
1497
debit_card_specializing
Which SME customer consumed the least in June 2012?
June 2012 refers to yearmonth.date = '201206'
SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Date = '201206' AND T1.Segment = 'SME' GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) ASC LIMIT 1
simple
1498
debit_card_specializing
What is the highest monthly consumption in the year 2012?
The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month.
SELECT SUM(Consumption) FROM yearmonth WHERE SUBSTR(Date, 1, 4) = '2012' GROUP BY SUBSTR(Date, 5, 2) ORDER BY SUM(Consumption) DESC LIMIT 1
simple
1499
debit_card_specializing
What is the biggest monthly consumption of the customers who use euro as their currency?
Monthly consumption = SUM(consumption) / 12
SELECT SUM(T2.Consumption) / 12 AS MonthlyConsumption FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'EUR' GROUP BY T1.CustomerID ORDER BY MonthlyConsumption DESC LIMIT 1
simple