Unnamed: 0
int64
0
60k
input
stringlengths
76
562
answer
stringlengths
18
557
3,100
<question>: What are the maximum and minimum age of students with major 600? <context>: CREATE TABLE STUDENT (Age INTEGER, Major VARCHAR)
SELECT MAX(Age), MIN(Age) FROM STUDENT WHERE Major = 600
3,101
<question>: Who are the advisors for students that live in a city with city code "BAL"? <context>: CREATE TABLE STUDENT (Advisor VARCHAR, city_code VARCHAR)
SELECT Advisor FROM STUDENT WHERE city_code = "BAL"
3,102
<question>: What are the distinct secretary votes in the fall election cycle? <context>: CREATE TABLE VOTING_RECORD (Secretary_Vote VARCHAR, ELECTION_CYCLE VARCHAR)
SELECT DISTINCT Secretary_Vote FROM VOTING_RECORD WHERE ELECTION_CYCLE = "Fall"
3,103
<question>: What are the distinct president votes on 08/30/2015? <context>: CREATE TABLE VOTING_RECORD (PRESIDENT_Vote VARCHAR, Registration_Date VARCHAR)
SELECT DISTINCT PRESIDENT_Vote FROM VOTING_RECORD WHERE Registration_Date = "08/30/2015"
3,104
<question>: Report the distinct registration date and the election cycle. <context>: CREATE TABLE VOTING_RECORD (Registration_Date VARCHAR, Election_Cycle VARCHAR)
SELECT DISTINCT Registration_Date, Election_Cycle FROM VOTING_RECORD
3,105
<question>: Report the distinct president vote and the vice president vote. <context>: CREATE TABLE VOTING_RECORD (President_Vote VARCHAR, VICE_President_Vote VARCHAR)
SELECT DISTINCT President_Vote, VICE_President_Vote FROM VOTING_RECORD
3,106
<question>: Find the distinct last names of the students who have class president votes. <context>: CREATE TABLE STUDENT (LName VARCHAR, StuID VARCHAR); CREATE TABLE VOTING_RECORD (CLASS_President_VOTE VARCHAR)
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_President_VOTE
3,107
<question>: Find the distinct first names of the students who have class senator votes. <context>: CREATE TABLE STUDENT (Fname VARCHAR, StuID VARCHAR); CREATE TABLE VOTING_RECORD (CLASS_Senator_VOTE VARCHAR)
SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_Senator_VOTE
3,108
<question>: Find the distinct ages of students who have secretary votes in the fall election cycle. <context>: CREATE TABLE VOTING_RECORD (Secretary_Vote VARCHAR, Election_Cycle VARCHAR); CREATE TABLE STUDENT (Age VARCHAR, StuID VARCHAR)
SELECT DISTINCT T1.Age FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = "Fall"
3,109
<question>: Find the distinct Advisor of students who have treasurer votes in the spring election cycle. <context>: CREATE TABLE STUDENT (Advisor VARCHAR, StuID VARCHAR); CREATE TABLE VOTING_RECORD (Treasurer_Vote VARCHAR, Election_Cycle VARCHAR)
SELECT DISTINCT T1.Advisor FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = "Spring"
3,110
<question>: Find the distinct majors of students who have treasurer votes. <context>: CREATE TABLE VOTING_RECORD (Treasurer_Vote VARCHAR); CREATE TABLE STUDENT (Major VARCHAR, StuID VARCHAR)
SELECT DISTINCT T1.Major FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote
3,111
<question>: Find the first and last names of all the female (sex is F) students who have president votes. <context>: CREATE TABLE STUDENT (Fname VARCHAR, LName VARCHAR, StuID VARCHAR, sex VARCHAR); CREATE TABLE VOTING_RECORD (President_VOTE VARCHAR)
SELECT DISTINCT T1.Fname, T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.President_VOTE WHERE T1.sex = "F"
3,112
<question>: Find the first and last name of all the students of age 18 who have vice president votes. <context>: CREATE TABLE STUDENT (Fname VARCHAR, LName VARCHAR, StuID VARCHAR, age VARCHAR); CREATE TABLE VOTING_RECORD (VICE_President_VOTE VARCHAR)
SELECT DISTINCT T1.Fname, T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_President_VOTE WHERE T1.age = 18
3,113
<question>: How many male (sex is M) students have class senator votes in the fall election cycle? <context>: CREATE TABLE VOTING_RECORD (Election_Cycle VARCHAR); CREATE TABLE STUDENT (StuID VARCHAR, Sex VARCHAR)
SELECT COUNT(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.Sex = "M" AND T2.Election_Cycle = "Fall"
3,114
<question>: Find the number of students whose city code is NYC and who have class senator votes in the spring election cycle. <context>: CREATE TABLE STUDENT (StuID VARCHAR, city_code VARCHAR); CREATE TABLE VOTING_RECORD (Election_Cycle VARCHAR)
SELECT COUNT(*) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = Class_Senator_Vote WHERE T1.city_code = "NYC" AND T2.Election_Cycle = "Spring"
3,115
<question>: Find the average age of students who live in the city with code "NYC" and have secretary votes in the spring election cycle. <context>: CREATE TABLE STUDENT (Age INTEGER, StuID VARCHAR, city_code VARCHAR); CREATE TABLE VOTING_RECORD (Election_Cycle VARCHAR)
SELECT AVG(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.city_code = "NYC" AND T2.Election_Cycle = "Spring"
3,116
<question>: Find the average age of female (sex is F) students who have secretary votes in the spring election cycle. <context>: CREATE TABLE STUDENT (Age INTEGER, StuID VARCHAR, Sex VARCHAR); CREATE TABLE VOTING_RECORD (Election_Cycle VARCHAR)
SELECT AVG(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.Sex = "F" AND T2.Election_Cycle = "Spring"
3,117
<question>: Find the distinct first names of all the students who have vice president votes and whose city code is not PIT. <context>: CREATE TABLE STUDENT (Fname VARCHAR, city_code VARCHAR); CREATE TABLE STUDENT (Fname VARCHAR, StuID VARCHAR); CREATE TABLE VOTING_RECORD (VICE_PRESIDENT_Vote VARCHAR)
SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code = "PIT"
3,118
<question>: Find the distinct last names of all the students who have president votes and whose advisor is not 2192. <context>: CREATE TABLE STUDENT (LName VARCHAR, PRESIDENT_Vote VARCHAR, Advisor VARCHAR); CREATE TABLE STUDENT (LName VARCHAR, StuID VARCHAR); CREATE TABLE VOTING_RECORD (Id VARCHAR)
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote EXCEPT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = "2192"
3,119
<question>: Find the distinct last names of all the students who have president votes and whose advisor is 8741. <context>: CREATE TABLE STUDENT (LName VARCHAR, PRESIDENT_Vote VARCHAR, Advisor VARCHAR); CREATE TABLE STUDENT (LName VARCHAR, StuID VARCHAR); CREATE TABLE VOTING_RECORD (Id VARCHAR)
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor = "8741"
3,120
<question>: For each advisor, report the total number of students advised by him or her. <context>: CREATE TABLE STUDENT (Advisor VARCHAR)
SELECT Advisor, COUNT(*) FROM STUDENT GROUP BY Advisor
3,121
<question>: Report all advisors that advise more than 2 students. <context>: CREATE TABLE STUDENT (Advisor VARCHAR)
SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*) > 2
3,122
<question>: Report all majors that have less than 3 students. <context>: CREATE TABLE STUDENT (Major VARCHAR)
SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*) < 3
3,123
<question>: For each election cycle, report the number of voting records. <context>: CREATE TABLE VOTING_RECORD (Election_Cycle VARCHAR)
SELECT Election_Cycle, COUNT(*) FROM VOTING_RECORD GROUP BY Election_Cycle
3,124
<question>: Which major has the most students? <context>: CREATE TABLE STUDENT (Major VARCHAR, major VARCHAR)
SELECT Major FROM STUDENT GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1
3,125
<question>: What is the most common major among female (sex is F) students? <context>: CREATE TABLE STUDENT (Major VARCHAR, major VARCHAR, Sex VARCHAR)
SELECT Major FROM STUDENT WHERE Sex = "F" GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1
3,126
<question>: What is the city_code of the city that the most students live in? <context>: CREATE TABLE STUDENT (city_code VARCHAR)
SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY COUNT(*) DESC LIMIT 1
3,127
<question>: How many products are there? <context>: CREATE TABLE products (Id VARCHAR)
SELECT COUNT(*) FROM products
3,128
<question>: How many colors are there? <context>: CREATE TABLE ref_colors (Id VARCHAR)
SELECT COUNT(*) FROM ref_colors
3,129
<question>: How many characteristics are there? <context>: CREATE TABLE CHARACTERISTICS (Id VARCHAR)
SELECT COUNT(*) FROM CHARACTERISTICS
3,130
<question>: What are the names and buying prices of all the products? <context>: CREATE TABLE products (product_name VARCHAR, typical_buying_price VARCHAR)
SELECT product_name, typical_buying_price FROM products
3,131
<question>: List the description of all the colors. <context>: CREATE TABLE ref_colors (color_description VARCHAR)
SELECT color_description FROM ref_colors
3,132
<question>: Find the names of all the product characteristics. <context>: CREATE TABLE CHARACTERISTICS (characteristic_name VARCHAR)
SELECT DISTINCT characteristic_name FROM CHARACTERISTICS
3,133
<question>: What are the names of products with category "Spices"? <context>: CREATE TABLE products (product_name VARCHAR, product_category_code VARCHAR)
SELECT product_name FROM products WHERE product_category_code = "Spices"
3,134
<question>: List the names, color descriptions and product descriptions of products with category "Herbs". <context>: CREATE TABLE Ref_colors (color_description VARCHAR, color_code VARCHAR); CREATE TABLE products (product_name VARCHAR, product_description VARCHAR, color_code VARCHAR)
SELECT T1.product_name, T2.color_description, T1.product_description FROM products AS T1 JOIN Ref_colors AS T2 ON T1.color_code = T2.color_code WHERE product_category_code = "Herbs"
3,135
<question>: How many products are there under the category "Seeds"? <context>: CREATE TABLE products (product_category_code VARCHAR)
SELECT COUNT(*) FROM products WHERE product_category_code = "Seeds"
3,136
<question>: Find the number of products with category "Spices" and typically sold above 1000. <context>: CREATE TABLE products (product_category_code VARCHAR, typical_buying_price VARCHAR)
SELECT COUNT(*) FROM products WHERE product_category_code = "Spices" AND typical_buying_price > 1000
3,137
<question>: What is the category and typical buying price of the product with name "cumin"? <context>: CREATE TABLE products (product_category_code VARCHAR, typical_buying_price VARCHAR, product_name VARCHAR)
SELECT product_category_code, typical_buying_price FROM products WHERE product_name = "cumin"
3,138
<question>: Which category does the product named "flax" belong to? <context>: CREATE TABLE products (product_category_code VARCHAR, product_name VARCHAR)
SELECT product_category_code FROM products WHERE product_name = "flax"
3,139
<question>: What is the name of the product with the color description 'yellow'? <context>: CREATE TABLE ref_colors (color_code VARCHAR, color_description VARCHAR); CREATE TABLE products (product_name VARCHAR, color_code VARCHAR)
SELECT T1.product_name FROM products AS T1 JOIN ref_colors AS T2 ON T1.color_code = T2.color_code WHERE T2.color_description = 'yellow'
3,140
<question>: Find the category descriptions of the products whose descriptions include letter 't'. <context>: CREATE TABLE ref_product_categories (product_category_description VARCHAR, product_category_code VARCHAR); CREATE TABLE products (product_category_code VARCHAR, product_description VARCHAR)
SELECT T1.product_category_description FROM ref_product_categories AS T1 JOIN products AS T2 ON T1.product_category_code = T2.product_category_code WHERE T2.product_description LIKE '%t%'
3,141
<question>: What is the color description of the product with name "catnip"? <context>: CREATE TABLE products (color_code VARCHAR, product_name VARCHAR); CREATE TABLE ref_colors (color_description VARCHAR, color_code VARCHAR)
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = "catnip"
3,142
<question>: What is the color code and description of the product named "chervil"? <context>: CREATE TABLE products (color_code VARCHAR, product_name VARCHAR); CREATE TABLE ref_colors (color_description VARCHAR, color_code VARCHAR)
SELECT t1.color_code, t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t1.product_name = "chervil"
3,143
<question>: Find the id and color description of the products with at least 2 characteristics. <context>: CREATE TABLE product_characteristics (product_id VARCHAR); CREATE TABLE ref_colors (color_description VARCHAR, color_code VARCHAR); CREATE TABLE products (product_id VARCHAR, color_code VARCHAR)
SELECT t1.product_id, t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code JOIN product_characteristics AS t3 ON t1.product_id = t3.product_id GROUP BY t1.product_id HAVING COUNT(*) >= 2
3,144
<question>: List all the product names with the color description "white". <context>: CREATE TABLE ref_colors (color_code VARCHAR, color_description VARCHAR); CREATE TABLE products (product_name VARCHAR, color_code VARCHAR)
SELECT t1.product_name FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t2.color_description = "white"
3,145
<question>: What are the name and typical buying and selling prices of the products that have color described as "yellow"? <context>: CREATE TABLE ref_colors (color_code VARCHAR, color_description VARCHAR); CREATE TABLE products (product_name VARCHAR, typical_buying_price VARCHAR, typical_selling_price VARCHAR, color_code VARCHAR)
SELECT t1.product_name, t1.typical_buying_price, t1.typical_selling_price FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code WHERE t2.color_description = "yellow"
3,146
<question>: How many characteristics does the product named "sesame" have? <context>: CREATE TABLE product_characteristics (product_id VARCHAR); CREATE TABLE products (product_id VARCHAR, product_name VARCHAR)
SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id WHERE t1.product_name = "sesame"
3,147
<question>: How many distinct characteristic names does the product "cumin" have? <context>: CREATE TABLE CHARACTERISTICS (characteristic_name VARCHAR, characteristic_id VARCHAR); CREATE TABLE products (product_id VARCHAR, product_name VARCHAR); CREATE TABLE product_characteristics (product_id VARCHAR, characteristic_id VARCHAR)
SELECT COUNT(DISTINCT t3.characteristic_name) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
3,148
<question>: What are all the characteristic names of product "sesame"? <context>: CREATE TABLE CHARACTERISTICS (characteristic_name VARCHAR, characteristic_id VARCHAR); CREATE TABLE products (product_id VARCHAR, product_name VARCHAR); CREATE TABLE product_characteristics (product_id VARCHAR, characteristic_id VARCHAR)
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame"
3,149
<question>: List all the characteristic names and data types of product "cumin". <context>: CREATE TABLE CHARACTERISTICS (characteristic_name VARCHAR, characteristic_data_type VARCHAR, characteristic_id VARCHAR); CREATE TABLE products (product_id VARCHAR, product_name VARCHAR); CREATE TABLE product_characteristics (product_id VARCHAR, characteristic_id VARCHAR)
SELECT t3.characteristic_name, t3.characteristic_data_type FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "cumin"
3,150
<question>: List all characteristics of product named "sesame" with type code "Grade". <context>: CREATE TABLE CHARACTERISTICS (characteristic_name VARCHAR, characteristic_id VARCHAR, characteristic_type_code VARCHAR); CREATE TABLE products (product_id VARCHAR, product_name VARCHAR); CREATE TABLE product_characteristics (product_id VARCHAR, characteristic_id VARCHAR)
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "sesame" AND t3.characteristic_type_code = "Grade"
3,151
<question>: How many characteristics does the product named "laurel" have? <context>: CREATE TABLE CHARACTERISTICS (characteristic_id VARCHAR); CREATE TABLE products (product_id VARCHAR, product_name VARCHAR); CREATE TABLE product_characteristics (product_id VARCHAR, characteristic_id VARCHAR)
SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "laurel"
3,152
<question>: Find the number of characteristics that the product "flax" has. <context>: CREATE TABLE CHARACTERISTICS (characteristic_id VARCHAR); CREATE TABLE products (product_id VARCHAR, product_name VARCHAR); CREATE TABLE product_characteristics (product_id VARCHAR, characteristic_id VARCHAR)
SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t1.product_name = "flax"
3,153
<question>: Find the name of the products that have the color description "red" and have the characteristic name "fast". <context>: CREATE TABLE CHARACTERISTICS (characteristic_id VARCHAR, characteristic_name VARCHAR); CREATE TABLE ref_colors (color_code VARCHAR, color_description VARCHAR); CREATE TABLE products (product_id VARCHAR, color_code VARCHAR); CREATE TABLE product_characteristics (product_id VARCHAR, characteristic_id VARCHAR)
SELECT product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "red" AND t3.characteristic_name = "fast"
3,154
<question>: How many products have the characteristic named "hot"? <context>: CREATE TABLE products (product_id VARCHAR); CREATE TABLE CHARACTERISTICS (characteristic_id VARCHAR, characteristic_name VARCHAR); CREATE TABLE product_characteristics (product_id VARCHAR, characteristic_id VARCHAR)
SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t3.characteristic_name = "hot"
3,155
<question>: List the all the distinct names of the products with the characteristic name 'warm'. <context>: CREATE TABLE CHARACTERISTICS (characteristic_id VARCHAR, characteristic_name VARCHAR); CREATE TABLE products (product_name VARCHAR, product_id VARCHAR); CREATE TABLE product_characteristics (product_id VARCHAR, characteristic_id VARCHAR)
SELECT DISTINCT t1.product_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id WHERE t3.characteristic_name = "warm"
3,156
<question>: Find the number of the products that have their color described as "red" and have a characteristic named "slow". <context>: CREATE TABLE CHARACTERISTICS (characteristic_id VARCHAR, characteristic_name VARCHAR); CREATE TABLE ref_colors (color_code VARCHAR, color_description VARCHAR); CREATE TABLE products (product_id VARCHAR, color_code VARCHAR); CREATE TABLE product_characteristics (product_id VARCHAR, characteristic_id VARCHAR)
SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "red" AND t3.characteristic_name = "slow"
3,157
<question>: Count the products that have the color description "white" or have the characteristic name "hot". <context>: CREATE TABLE CHARACTERISTICS (characteristic_id VARCHAR, characteristic_name VARCHAR); CREATE TABLE ref_colors (color_code VARCHAR, color_description VARCHAR); CREATE TABLE products (product_id VARCHAR, color_code VARCHAR); CREATE TABLE product_characteristics (product_id VARCHAR, characteristic_id VARCHAR)
SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id JOIN ref_colors AS t4 ON t1.color_code = t4.color_code WHERE t4.color_description = "white" OR t3.characteristic_name = "hot"
3,158
<question>: What is the unit of measuerment of the product category code "Herbs"? <context>: CREATE TABLE ref_product_categories (unit_of_measure VARCHAR, product_category_code VARCHAR)
SELECT unit_of_measure FROM ref_product_categories WHERE product_category_code = "Herbs"
3,159
<question>: Find the product category description of the product category with code "Spices". <context>: CREATE TABLE ref_product_categories (product_category_description VARCHAR, product_category_code VARCHAR)
SELECT product_category_description FROM ref_product_categories WHERE product_category_code = "Spices"
3,160
<question>: What is the product category description and unit of measurement of category "Herbs"? <context>: CREATE TABLE ref_product_categories (product_category_description VARCHAR, unit_of_measure VARCHAR, product_category_code VARCHAR)
SELECT product_category_description, unit_of_measure FROM ref_product_categories WHERE product_category_code = "Herbs"
3,161
<question>: What is the unit of measurement of product named "cumin"? <context>: CREATE TABLE ref_product_categories (unit_of_measure VARCHAR, product_category_code VARCHAR); CREATE TABLE products (product_category_code VARCHAR, product_name VARCHAR)
SELECT t2.unit_of_measure FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = "cumin"
3,162
<question>: Find the unit of measurement and product category code of product named "chervil". <context>: CREATE TABLE ref_product_categories (unit_of_measure VARCHAR, product_category_code VARCHAR); CREATE TABLE products (product_category_code VARCHAR, product_name VARCHAR)
SELECT t2.unit_of_measure, t2.product_category_code FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code WHERE t1.product_name = "chervil"
3,163
<question>: Find the product names that are colored 'white' but do not have unit of measurement "Handful". <context>: CREATE TABLE products (product_name VARCHAR, product_category_code VARCHAR, color_code VARCHAR); CREATE TABLE ref_colors (color_code VARCHAR, color_description VARCHAR); CREATE TABLE ref_product_categories (product_category_code VARCHAR, unit_of_measure VARCHAR)
SELECT t1.product_name FROM products AS t1 JOIN ref_product_categories AS t2 ON t1.product_category_code = t2.product_category_code JOIN ref_colors AS t3 ON t1.color_code = t3.color_code WHERE t3.color_description = "white" AND t2.unit_of_measure <> "Handful"
3,164
<question>: What is the description of the color for most products? <context>: CREATE TABLE ref_colors (color_description VARCHAR, color_code VARCHAR); CREATE TABLE products (color_code VARCHAR)
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code GROUP BY t2.color_description ORDER BY COUNT(*) DESC LIMIT 1
3,165
<question>: What is the description of the color used by least products? <context>: CREATE TABLE ref_colors (color_description VARCHAR, color_code VARCHAR); CREATE TABLE products (color_code VARCHAR)
SELECT t2.color_description FROM products AS t1 JOIN ref_colors AS t2 ON t1.color_code = t2.color_code GROUP BY t2.color_description ORDER BY COUNT(*) LIMIT 1
3,166
<question>: What is the characteristic name used by most number of the products? <context>: CREATE TABLE products (product_id VARCHAR); CREATE TABLE CHARACTERISTICS (characteristic_name VARCHAR, characteristic_id VARCHAR); CREATE TABLE product_characteristics (product_id VARCHAR, characteristic_id VARCHAR)
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id GROUP BY t3.characteristic_name ORDER BY COUNT(*) DESC LIMIT 1
3,167
<question>: What are the names, details and data types of the characteristics which are never used by any product? <context>: CREATE TABLE CHARACTERISTICS (characteristic_name VARCHAR, other_characteristic_details VARCHAR, characteristic_data_type VARCHAR, characteristic_id VARCHAR); CREATE TABLE product_characteristics (characteristic_id VARCHAR); CREATE TABLE CHARACTERISTICS (characteristic_name VARCHAR, other_characteristic_details VARCHAR, characteristic_data_type VARCHAR)
SELECT characteristic_name, other_characteristic_details, characteristic_data_type FROM CHARACTERISTICS EXCEPT SELECT t1.characteristic_name, t1.other_characteristic_details, t1.characteristic_data_type FROM CHARACTERISTICS AS t1 JOIN product_characteristics AS t2 ON t1.characteristic_id = t2.characteristic_id
3,168
<question>: What are characteristic names used at least twice across all products? <context>: CREATE TABLE products (product_id VARCHAR); CREATE TABLE CHARACTERISTICS (characteristic_name VARCHAR, characteristic_id VARCHAR); CREATE TABLE product_characteristics (product_id VARCHAR, characteristic_id VARCHAR)
SELECT t3.characteristic_name FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id JOIN CHARACTERISTICS AS t3 ON t2.characteristic_id = t3.characteristic_id GROUP BY t3.characteristic_name HAVING COUNT(*) >= 2
3,169
<question>: How many colors are never used by any product? <context>: CREATE TABLE products (color_code VARCHAR); CREATE TABLE Ref_colors (color_code VARCHAR)
SELECT COUNT(*) FROM Ref_colors WHERE NOT color_code IN (SELECT color_code FROM products)
3,170
<question>: How many events are there? <context>: CREATE TABLE event (Id VARCHAR)
SELECT COUNT(*) FROM event
3,171
<question>: List all the event names by year from the most recent to the oldest. <context>: CREATE TABLE event (name VARCHAR, YEAR VARCHAR)
SELECT name FROM event ORDER BY YEAR DESC
3,172
<question>: What is the name of the event that happened in the most recent year? <context>: CREATE TABLE event (name VARCHAR, YEAR VARCHAR)
SELECT name FROM event ORDER BY YEAR DESC LIMIT 1
3,173
<question>: How many stadiums are there? <context>: CREATE TABLE stadium (Id VARCHAR)
SELECT COUNT(*) FROM stadium
3,174
<question>: Find the name of the stadium that has the maximum capacity. <context>: CREATE TABLE stadium (name VARCHAR, capacity VARCHAR)
SELECT name FROM stadium ORDER BY capacity DESC LIMIT 1
3,175
<question>: Find the names of stadiums whose capacity is smaller than the average capacity. <context>: CREATE TABLE stadium (name VARCHAR, capacity INTEGER)
SELECT name FROM stadium WHERE capacity < (SELECT AVG(capacity) FROM stadium)
3,176
<question>: Find the country that has the most stadiums. <context>: CREATE TABLE stadium (country VARCHAR)
SELECT country FROM stadium GROUP BY country ORDER BY COUNT(*) DESC LIMIT 1
3,177
<question>: Which country has at most 3 stadiums listed? <context>: CREATE TABLE stadium (country VARCHAR)
SELECT country FROM stadium GROUP BY country HAVING COUNT(*) <= 3
3,178
<question>: Which country has both stadiums with capacity greater than 60000 and stadiums with capacity less than 50000? <context>: CREATE TABLE stadium (country VARCHAR, capacity INTEGER)
SELECT country FROM stadium WHERE capacity > 60000 INTERSECT SELECT country FROM stadium WHERE capacity < 50000
3,179
<question>: How many cities have a stadium that was opened before the year of 2006? <context>: CREATE TABLE stadium (city VARCHAR, opening_year INTEGER)
SELECT COUNT(DISTINCT city) FROM stadium WHERE opening_year < 2006
3,180
<question>: How many stadiums does each country have? <context>: CREATE TABLE stadium (country VARCHAR)
SELECT country, COUNT(*) FROM stadium GROUP BY country
3,181
<question>: Which countries do not have a stadium that was opened after 2006? <context>: CREATE TABLE stadium (country VARCHAR, opening_year INTEGER)
SELECT country FROM stadium EXCEPT SELECT country FROM stadium WHERE opening_year > 2006
3,182
<question>: How many stadiums are not in country "Russia"? <context>: CREATE TABLE stadium (country VARCHAR)
SELECT COUNT(*) FROM stadium WHERE country <> 'Russia'
3,183
<question>: Find the names of all swimmers, sorted by their 100 meter scores in ascending order. <context>: CREATE TABLE swimmer (name VARCHAR, meter_100 VARCHAR)
SELECT name FROM swimmer ORDER BY meter_100
3,184
<question>: How many different countries are all the swimmers from? <context>: CREATE TABLE swimmer (nationality VARCHAR)
SELECT COUNT(DISTINCT nationality) FROM swimmer
3,185
<question>: List countries that have more than one swimmer. <context>: CREATE TABLE swimmer (nationality VARCHAR)
SELECT nationality, COUNT(*) FROM swimmer GROUP BY nationality HAVING COUNT(*) > 1
3,186
<question>: Find all 200 meter and 300 meter results of swimmers with nationality "Australia". <context>: CREATE TABLE swimmer (meter_200 VARCHAR, meter_300 VARCHAR, nationality VARCHAR)
SELECT meter_200, meter_300 FROM swimmer WHERE nationality = 'Australia'
3,187
<question>: Find the names of swimmers who has a result of "win". <context>: CREATE TABLE record (swimmer_id VARCHAR); CREATE TABLE swimmer (name VARCHAR, id VARCHAR)
SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win'
3,188
<question>: What is the name of the stadium which held the most events? <context>: CREATE TABLE stadium (name VARCHAR, id VARCHAR); CREATE TABLE event (stadium_id VARCHAR)
SELECT t1.name FROM stadium AS t1 JOIN event AS t2 ON t1.id = t2.stadium_id GROUP BY t2.stadium_id ORDER BY COUNT(*) DESC LIMIT 1
3,189
<question>: Find the name and capacity of the stadium where the event named "World Junior" happened. <context>: CREATE TABLE event (stadium_id VARCHAR, name VARCHAR); CREATE TABLE stadium (name VARCHAR, capacity VARCHAR, id VARCHAR)
SELECT t1.name, t1.capacity FROM stadium AS t1 JOIN event AS t2 ON t1.id = t2.stadium_id WHERE t2.name = 'World Junior'
3,190
<question>: Find the names of stadiums which have never had any event. <context>: CREATE TABLE stadium (name VARCHAR, id VARCHAR, stadium_id VARCHAR); CREATE TABLE event (name VARCHAR, id VARCHAR, stadium_id VARCHAR)
SELECT name FROM stadium WHERE NOT id IN (SELECT stadium_id FROM event)
3,191
<question>: Find the name of the swimmer who has the most records. <context>: CREATE TABLE record (swimmer_id VARCHAR); CREATE TABLE swimmer (name VARCHAR, id VARCHAR)
SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id GROUP BY t2.swimmer_id ORDER BY COUNT(*) DESC LIMIT 1
3,192
<question>: Find the name of the swimmer who has at least 2 records. <context>: CREATE TABLE record (swimmer_id VARCHAR); CREATE TABLE swimmer (name VARCHAR, id VARCHAR)
SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id GROUP BY t2.swimmer_id HAVING COUNT(*) >= 2
3,193
<question>: Find the name and nationality of the swimmer who has won (i.e., has a result of "win") more than 1 time. <context>: CREATE TABLE record (swimmer_id VARCHAR); CREATE TABLE swimmer (name VARCHAR, nationality VARCHAR, id VARCHAR)
SELECT t1.name, t1.nationality FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win' GROUP BY t2.swimmer_id HAVING COUNT(*) > 1
3,194
<question>: Find the names of the swimmers who have no record. <context>: CREATE TABLE swimmer (name VARCHAR, id VARCHAR, swimmer_id VARCHAR); CREATE TABLE record (name VARCHAR, id VARCHAR, swimmer_id VARCHAR)
SELECT name FROM swimmer WHERE NOT id IN (SELECT swimmer_id FROM record)
3,195
<question>: Find the names of the swimmers who have both "win" and "loss" results in the record. <context>: CREATE TABLE record (swimmer_id VARCHAR); CREATE TABLE swimmer (name VARCHAR, id VARCHAR)
SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win' INTERSECT SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Loss'
3,196
<question>: Find the names of stadiums that some Australian swimmers have been to. <context>: CREATE TABLE swimmer (id VARCHAR, nationality VARCHAR); CREATE TABLE record (swimmer_id VARCHAR, event_id VARCHAR); CREATE TABLE stadium (name VARCHAR, id VARCHAR); CREATE TABLE event (id VARCHAR, stadium_id VARCHAR)
SELECT t4.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id JOIN event AS t3 ON t2.event_id = t3.id JOIN stadium AS t4 ON t4.id = t3.stadium_id WHERE t1.nationality = 'Australia'
3,197
<question>: Find the names of stadiums that the most swimmers have been to. <context>: CREATE TABLE record (event_id VARCHAR); CREATE TABLE stadium (name VARCHAR, id VARCHAR); CREATE TABLE event (stadium_id VARCHAR, id VARCHAR)
SELECT t3.name FROM record AS t1 JOIN event AS t2 ON t1.event_id = t2.id JOIN stadium AS t3 ON t3.id = t2.stadium_id GROUP BY t2.stadium_id ORDER BY COUNT(*) DESC LIMIT 1
3,198
<question>: Find all details for each swimmer. <context>: CREATE TABLE swimmer (Id VARCHAR)
SELECT * FROM swimmer
3,199
<question>: What is the average capacity of the stadiums that were opened in year 2005? <context>: CREATE TABLE stadium (capacity INTEGER, opening_year VARCHAR)
SELECT AVG(capacity) FROM stadium WHERE opening_year = 2005