text
stringlengths 114
1.06k
|
---|
### question: What are the maximum and minimum age of students with major 600? ### answer: SELECT MAX(Age), MIN(Age) FROM STUDENT WHERE Major = 600 ### context: CREATE TABLE STUDENT (Age INTEGER, Major VARCHAR) |
### question: Who are the advisors for students that live in a city with city code "BAL"? ### answer: SELECT Advisor FROM STUDENT WHERE city_code = "BAL" ### context: CREATE TABLE STUDENT (Advisor VARCHAR, city_code VARCHAR) |
### question: What are the distinct secretary votes in the fall election cycle? ### answer: SELECT DISTINCT Secretary_Vote FROM VOTING_RECORD WHERE ELECTION_CYCLE = "Fall" ### context: CREATE TABLE VOTING_RECORD (Secretary_Vote VARCHAR, ELECTION_CYCLE VARCHAR) |
### question: What are the distinct president votes on 08/30/2015? ### answer: SELECT DISTINCT PRESIDENT_Vote FROM VOTING_RECORD WHERE Registration_Date = "08/30/2015" ### context: CREATE TABLE VOTING_RECORD (PRESIDENT_Vote VARCHAR, Registration_Date VARCHAR) |
### question: Report the distinct registration date and the election cycle. ### answer: SELECT DISTINCT Registration_Date, Election_Cycle FROM VOTING_RECORD ### context: CREATE TABLE VOTING_RECORD (Registration_Date VARCHAR, Election_Cycle VARCHAR) |
### question: Report the distinct president vote and the vice president vote. ### answer: SELECT DISTINCT President_Vote, VICE_President_Vote FROM VOTING_RECORD ### context: CREATE TABLE VOTING_RECORD (President_Vote VARCHAR, VICE_President_Vote VARCHAR) |
### question: Find the distinct last names of the students who have class president votes. ### answer: SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_President_VOTE ### context: CREATE TABLE STUDENT (LName VARCHAR, StuID VARCHAR); CREATE TABLE VOTING_RECORD (CLASS_President_VOTE VARCHAR) |
### question: Find the distinct first names of the students who have class senator votes. ### answer: SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.CLASS_Senator_VOTE ### context: CREATE TABLE STUDENT (Fname VARCHAR, StuID VARCHAR); CREATE TABLE VOTING_RECORD (CLASS_Senator_VOTE VARCHAR) |
### question: Find the distinct ages of students who have secretary votes in the fall election cycle. ### answer: SELECT DISTINCT T1.Age FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Secretary_Vote WHERE T2.Election_Cycle = "Fall" ### context: CREATE TABLE VOTING_RECORD (Secretary_Vote VARCHAR, Election_Cycle VARCHAR); CREATE TABLE STUDENT (Age VARCHAR, StuID VARCHAR) |
### question: Find the distinct Advisor of students who have treasurer votes in the spring election cycle. ### answer: SELECT DISTINCT T1.Advisor FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote WHERE T2.Election_Cycle = "Spring" ### context: CREATE TABLE STUDENT (Advisor VARCHAR, StuID VARCHAR); CREATE TABLE VOTING_RECORD (Treasurer_Vote VARCHAR, Election_Cycle VARCHAR) |
### question: Find the distinct majors of students who have treasurer votes. ### answer: SELECT DISTINCT T1.Major FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = T2.Treasurer_Vote ### context: CREATE TABLE VOTING_RECORD (Treasurer_Vote VARCHAR); CREATE TABLE STUDENT (Major VARCHAR, StuID VARCHAR) |
### question: Find the first and last names of all the female (sex is F) students who have president votes. ### answer: 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" ### context: CREATE TABLE STUDENT (Fname VARCHAR, LName VARCHAR, StuID VARCHAR, sex VARCHAR); CREATE TABLE VOTING_RECORD (President_VOTE VARCHAR) |
### question: Find the first and last name of all the students of age 18 who have vice president votes. ### answer: 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 ### context: CREATE TABLE STUDENT (Fname VARCHAR, LName VARCHAR, StuID VARCHAR, age VARCHAR); CREATE TABLE VOTING_RECORD (VICE_President_VOTE VARCHAR) |
### question: How many male (sex is M) students have class senator votes in the fall election cycle? ### answer: 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" ### context: CREATE TABLE VOTING_RECORD (Election_Cycle VARCHAR); CREATE TABLE STUDENT (StuID VARCHAR, Sex VARCHAR) |
### question: Find the number of students whose city code is NYC and who have class senator votes in the spring election cycle. ### answer: 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" ### context: CREATE TABLE STUDENT (StuID VARCHAR, city_code VARCHAR); CREATE TABLE VOTING_RECORD (Election_Cycle VARCHAR) |
### question: Find the average age of students who live in the city with code "NYC" and have secretary votes in the spring election cycle. ### answer: 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" ### context: CREATE TABLE STUDENT (Age INTEGER, StuID VARCHAR, city_code VARCHAR); CREATE TABLE VOTING_RECORD (Election_Cycle VARCHAR) |
### question: Find the average age of female (sex is F) students who have secretary votes in the spring election cycle. ### answer: 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" ### context: CREATE TABLE STUDENT (Age INTEGER, StuID VARCHAR, Sex VARCHAR); CREATE TABLE VOTING_RECORD (Election_Cycle VARCHAR) |
### question: Find the distinct first names of all the students who have vice president votes and whose city code is not PIT. ### answer: 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" ### context: CREATE TABLE STUDENT (Fname VARCHAR, city_code VARCHAR); CREATE TABLE STUDENT (Fname VARCHAR, StuID VARCHAR); CREATE TABLE VOTING_RECORD (VICE_PRESIDENT_Vote VARCHAR) |
### question: Find the distinct last names of all the students who have president votes and whose advisor is not 2192. ### answer: 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" ### context: CREATE TABLE STUDENT (LName VARCHAR, PRESIDENT_Vote VARCHAR, Advisor VARCHAR); CREATE TABLE STUDENT (LName VARCHAR, StuID VARCHAR); CREATE TABLE VOTING_RECORD (Id VARCHAR) |
### question: Find the distinct last names of all the students who have president votes and whose advisor is 8741. ### answer: 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" ### context: CREATE TABLE STUDENT (LName VARCHAR, PRESIDENT_Vote VARCHAR, Advisor VARCHAR); CREATE TABLE STUDENT (LName VARCHAR, StuID VARCHAR); CREATE TABLE VOTING_RECORD (Id VARCHAR) |
### question: For each advisor, report the total number of students advised by him or her. ### answer: SELECT Advisor, COUNT(*) FROM STUDENT GROUP BY Advisor ### context: CREATE TABLE STUDENT (Advisor VARCHAR) |
### question: Report all advisors that advise more than 2 students. ### answer: SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*) > 2 ### context: CREATE TABLE STUDENT (Advisor VARCHAR) |
### question: Report all majors that have less than 3 students. ### answer: SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*) < 3 ### context: CREATE TABLE STUDENT (Major VARCHAR) |
### question: For each election cycle, report the number of voting records. ### answer: SELECT Election_Cycle, COUNT(*) FROM VOTING_RECORD GROUP BY Election_Cycle ### context: CREATE TABLE VOTING_RECORD (Election_Cycle VARCHAR) |
### question: Which major has the most students? ### answer: SELECT Major FROM STUDENT GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE STUDENT (Major VARCHAR, major VARCHAR) |
### question: What is the most common major among female (sex is F) students? ### answer: SELECT Major FROM STUDENT WHERE Sex = "F" GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE STUDENT (Major VARCHAR, major VARCHAR, Sex VARCHAR) |
### question: What is the city_code of the city that the most students live in? ### answer: SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE STUDENT (city_code VARCHAR) |
### question: How many products are there? ### answer: SELECT COUNT(*) FROM products ### context: CREATE TABLE products (Id VARCHAR) |
### question: How many colors are there? ### answer: SELECT COUNT(*) FROM ref_colors ### context: CREATE TABLE ref_colors (Id VARCHAR) |
### question: How many characteristics are there? ### answer: SELECT COUNT(*) FROM CHARACTERISTICS ### context: CREATE TABLE CHARACTERISTICS (Id VARCHAR) |
### question: What are the names and buying prices of all the products? ### answer: SELECT product_name, typical_buying_price FROM products ### context: CREATE TABLE products (product_name VARCHAR, typical_buying_price VARCHAR) |
### question: List the description of all the colors. ### answer: SELECT color_description FROM ref_colors ### context: CREATE TABLE ref_colors (color_description VARCHAR) |
### question: Find the names of all the product characteristics. ### answer: SELECT DISTINCT characteristic_name FROM CHARACTERISTICS ### context: CREATE TABLE CHARACTERISTICS (characteristic_name VARCHAR) |
### question: What are the names of products with category "Spices"? ### answer: SELECT product_name FROM products WHERE product_category_code = "Spices" ### context: CREATE TABLE products (product_name VARCHAR, product_category_code VARCHAR) |
### question: List the names, color descriptions and product descriptions of products with category "Herbs". ### answer: 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" ### context: CREATE TABLE Ref_colors (color_description VARCHAR, color_code VARCHAR); CREATE TABLE products (product_name VARCHAR, product_description VARCHAR, color_code VARCHAR) |
### question: How many products are there under the category "Seeds"? ### answer: SELECT COUNT(*) FROM products WHERE product_category_code = "Seeds" ### context: CREATE TABLE products (product_category_code VARCHAR) |
### question: Find the number of products with category "Spices" and typically sold above 1000. ### answer: SELECT COUNT(*) FROM products WHERE product_category_code = "Spices" AND typical_buying_price > 1000 ### context: CREATE TABLE products (product_category_code VARCHAR, typical_buying_price VARCHAR) |
### question: What is the category and typical buying price of the product with name "cumin"? ### answer: SELECT product_category_code, typical_buying_price FROM products WHERE product_name = "cumin" ### context: CREATE TABLE products (product_category_code VARCHAR, typical_buying_price VARCHAR, product_name VARCHAR) |
### question: Which category does the product named "flax" belong to? ### answer: SELECT product_category_code FROM products WHERE product_name = "flax" ### context: CREATE TABLE products (product_category_code VARCHAR, product_name VARCHAR) |
### question: What is the name of the product with the color description 'yellow'? ### answer: 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' ### context: CREATE TABLE ref_colors (color_code VARCHAR, color_description VARCHAR); CREATE TABLE products (product_name VARCHAR, color_code VARCHAR) |
### question: Find the category descriptions of the products whose descriptions include letter 't'. ### answer: 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%' ### context: CREATE TABLE ref_product_categories (product_category_description VARCHAR, product_category_code VARCHAR); CREATE TABLE products (product_category_code VARCHAR, product_description VARCHAR) |
### question: What is the color description of the product with name "catnip"? ### answer: 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" ### context: CREATE TABLE products (color_code VARCHAR, product_name VARCHAR); CREATE TABLE ref_colors (color_description VARCHAR, color_code VARCHAR) |
### question: What is the color code and description of the product named "chervil"? ### answer: 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" ### context: CREATE TABLE products (color_code VARCHAR, product_name VARCHAR); CREATE TABLE ref_colors (color_description VARCHAR, color_code VARCHAR) |
### question: Find the id and color description of the products with at least 2 characteristics. ### answer: 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 ### 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) |
### question: List all the product names with the color description "white". ### answer: 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" ### context: CREATE TABLE ref_colors (color_code VARCHAR, color_description VARCHAR); CREATE TABLE products (product_name VARCHAR, color_code VARCHAR) |
### question: What are the name and typical buying and selling prices of the products that have color described as "yellow"? ### answer: 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" ### 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) |
### question: How many characteristics does the product named "sesame" have? ### answer: SELECT COUNT(*) FROM products AS t1 JOIN product_characteristics AS t2 ON t1.product_id = t2.product_id WHERE t1.product_name = "sesame" ### context: CREATE TABLE product_characteristics (product_id VARCHAR); CREATE TABLE products (product_id VARCHAR, product_name VARCHAR) |
### question: How many distinct characteristic names does the product "cumin" have? ### answer: 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" ### 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) |
### question: What are all the characteristic names of product "sesame"? ### answer: 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" ### 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) |
### question: List all the characteristic names and data types of product "cumin". ### answer: 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" ### 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) |
### question: List all characteristics of product named "sesame" with type code "Grade". ### answer: 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" ### 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) |
### question: How many characteristics does the product named "laurel" have? ### answer: 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" ### 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) |
### question: Find the number of characteristics that the product "flax" has. ### answer: 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" ### 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) |
### question: Find the name of the products that have the color description "red" and have the characteristic name "fast". ### answer: 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" ### 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) |
### question: How many products have the characteristic named "hot"? ### answer: 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" ### 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) |
### question: List the all the distinct names of the products with the characteristic name 'warm'. ### answer: 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" ### 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) |
### question: Find the number of the products that have their color described as "red" and have a characteristic named "slow". ### answer: 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" ### 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) |
### question: Count the products that have the color description "white" or have the characteristic name "hot". ### answer: 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" ### 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) |
### question: What is the unit of measuerment of the product category code "Herbs"? ### answer: SELECT unit_of_measure FROM ref_product_categories WHERE product_category_code = "Herbs" ### context: CREATE TABLE ref_product_categories (unit_of_measure VARCHAR, product_category_code VARCHAR) |
### question: Find the product category description of the product category with code "Spices". ### answer: SELECT product_category_description FROM ref_product_categories WHERE product_category_code = "Spices" ### context: CREATE TABLE ref_product_categories (product_category_description VARCHAR, product_category_code VARCHAR) |
### question: What is the product category description and unit of measurement of category "Herbs"? ### answer: SELECT product_category_description, unit_of_measure FROM ref_product_categories WHERE product_category_code = "Herbs" ### context: CREATE TABLE ref_product_categories (product_category_description VARCHAR, unit_of_measure VARCHAR, product_category_code VARCHAR) |
### question: What is the unit of measurement of product named "cumin"? ### answer: 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" ### context: CREATE TABLE ref_product_categories (unit_of_measure VARCHAR, product_category_code VARCHAR); CREATE TABLE products (product_category_code VARCHAR, product_name VARCHAR) |
### question: Find the unit of measurement and product category code of product named "chervil". ### answer: 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" ### context: CREATE TABLE ref_product_categories (unit_of_measure VARCHAR, product_category_code VARCHAR); CREATE TABLE products (product_category_code VARCHAR, product_name VARCHAR) |
### question: Find the product names that are colored 'white' but do not have unit of measurement "Handful". ### answer: 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" ### 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) |
### question: What is the description of the color for most products? ### answer: 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 ### context: CREATE TABLE ref_colors (color_description VARCHAR, color_code VARCHAR); CREATE TABLE products (color_code VARCHAR) |
### question: What is the description of the color used by least products? ### answer: 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 ### context: CREATE TABLE ref_colors (color_description VARCHAR, color_code VARCHAR); CREATE TABLE products (color_code VARCHAR) |
### question: What is the characteristic name used by most number of the products? ### answer: 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 ### 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) |
### question: What are the names, details and data types of the characteristics which are never used by any product? ### answer: 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 ### 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) |
### question: What are characteristic names used at least twice across all products? ### answer: 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 ### 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) |
### question: How many colors are never used by any product? ### answer: SELECT COUNT(*) FROM Ref_colors WHERE NOT color_code IN (SELECT color_code FROM products) ### context: CREATE TABLE products (color_code VARCHAR); CREATE TABLE Ref_colors (color_code VARCHAR) |
### question: How many events are there? ### answer: SELECT COUNT(*) FROM event ### context: CREATE TABLE event (Id VARCHAR) |
### question: List all the event names by year from the most recent to the oldest. ### answer: SELECT name FROM event ORDER BY YEAR DESC ### context: CREATE TABLE event (name VARCHAR, YEAR VARCHAR) |
### question: What is the name of the event that happened in the most recent year? ### answer: SELECT name FROM event ORDER BY YEAR DESC LIMIT 1 ### context: CREATE TABLE event (name VARCHAR, YEAR VARCHAR) |
### question: How many stadiums are there? ### answer: SELECT COUNT(*) FROM stadium ### context: CREATE TABLE stadium (Id VARCHAR) |
### question: Find the name of the stadium that has the maximum capacity. ### answer: SELECT name FROM stadium ORDER BY capacity DESC LIMIT 1 ### context: CREATE TABLE stadium (name VARCHAR, capacity VARCHAR) |
### question: Find the names of stadiums whose capacity is smaller than the average capacity. ### answer: SELECT name FROM stadium WHERE capacity < (SELECT AVG(capacity) FROM stadium) ### context: CREATE TABLE stadium (name VARCHAR, capacity INTEGER) |
### question: Find the country that has the most stadiums. ### answer: SELECT country FROM stadium GROUP BY country ORDER BY COUNT(*) DESC LIMIT 1 ### context: CREATE TABLE stadium (country VARCHAR) |
### question: Which country has at most 3 stadiums listed? ### answer: SELECT country FROM stadium GROUP BY country HAVING COUNT(*) <= 3 ### context: CREATE TABLE stadium (country VARCHAR) |
### question: Which country has both stadiums with capacity greater than 60000 and stadiums with capacity less than 50000? ### answer: SELECT country FROM stadium WHERE capacity > 60000 INTERSECT SELECT country FROM stadium WHERE capacity < 50000 ### context: CREATE TABLE stadium (country VARCHAR, capacity INTEGER) |
### question: How many cities have a stadium that was opened before the year of 2006? ### answer: SELECT COUNT(DISTINCT city) FROM stadium WHERE opening_year < 2006 ### context: CREATE TABLE stadium (city VARCHAR, opening_year INTEGER) |
### question: How many stadiums does each country have? ### answer: SELECT country, COUNT(*) FROM stadium GROUP BY country ### context: CREATE TABLE stadium (country VARCHAR) |
### question: Which countries do not have a stadium that was opened after 2006? ### answer: SELECT country FROM stadium EXCEPT SELECT country FROM stadium WHERE opening_year > 2006 ### context: CREATE TABLE stadium (country VARCHAR, opening_year INTEGER) |
### question: How many stadiums are not in country "Russia"? ### answer: SELECT COUNT(*) FROM stadium WHERE country <> 'Russia' ### context: CREATE TABLE stadium (country VARCHAR) |
### question: Find the names of all swimmers, sorted by their 100 meter scores in ascending order. ### answer: SELECT name FROM swimmer ORDER BY meter_100 ### context: CREATE TABLE swimmer (name VARCHAR, meter_100 VARCHAR) |
### question: How many different countries are all the swimmers from? ### answer: SELECT COUNT(DISTINCT nationality) FROM swimmer ### context: CREATE TABLE swimmer (nationality VARCHAR) |
### question: List countries that have more than one swimmer. ### answer: SELECT nationality, COUNT(*) FROM swimmer GROUP BY nationality HAVING COUNT(*) > 1 ### context: CREATE TABLE swimmer (nationality VARCHAR) |
### question: Find all 200 meter and 300 meter results of swimmers with nationality "Australia". ### answer: SELECT meter_200, meter_300 FROM swimmer WHERE nationality = 'Australia' ### context: CREATE TABLE swimmer (meter_200 VARCHAR, meter_300 VARCHAR, nationality VARCHAR) |
### question: Find the names of swimmers who has a result of "win". ### answer: SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win' ### context: CREATE TABLE record (swimmer_id VARCHAR); CREATE TABLE swimmer (name VARCHAR, id VARCHAR) |
### question: What is the name of the stadium which held the most events? ### answer: 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 ### context: CREATE TABLE stadium (name VARCHAR, id VARCHAR); CREATE TABLE event (stadium_id VARCHAR) |
### question: Find the name and capacity of the stadium where the event named "World Junior" happened. ### answer: SELECT t1.name, t1.capacity FROM stadium AS t1 JOIN event AS t2 ON t1.id = t2.stadium_id WHERE t2.name = 'World Junior' ### context: CREATE TABLE event (stadium_id VARCHAR, name VARCHAR); CREATE TABLE stadium (name VARCHAR, capacity VARCHAR, id VARCHAR) |
### question: Find the names of stadiums which have never had any event. ### answer: SELECT name FROM stadium WHERE NOT id IN (SELECT stadium_id FROM event) ### context: CREATE TABLE stadium (name VARCHAR, id VARCHAR, stadium_id VARCHAR); CREATE TABLE event (name VARCHAR, id VARCHAR, stadium_id VARCHAR) |
### question: Find the name of the swimmer who has the most records. ### answer: 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 ### context: CREATE TABLE record (swimmer_id VARCHAR); CREATE TABLE swimmer (name VARCHAR, id VARCHAR) |
### question: Find the name of the swimmer who has at least 2 records. ### answer: 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 ### context: CREATE TABLE record (swimmer_id VARCHAR); CREATE TABLE swimmer (name VARCHAR, id VARCHAR) |
### question: Find the name and nationality of the swimmer who has won (i.e., has a result of "win") more than 1 time. ### answer: 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 ### context: CREATE TABLE record (swimmer_id VARCHAR); CREATE TABLE swimmer (name VARCHAR, nationality VARCHAR, id VARCHAR) |
### question: Find the names of the swimmers who have no record. ### answer: SELECT name FROM swimmer WHERE NOT id IN (SELECT swimmer_id FROM record) ### context: CREATE TABLE swimmer (name VARCHAR, id VARCHAR, swimmer_id VARCHAR); CREATE TABLE record (name VARCHAR, id VARCHAR, swimmer_id VARCHAR) |
### question: Find the names of the swimmers who have both "win" and "loss" results in the record. ### answer: 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' ### context: CREATE TABLE record (swimmer_id VARCHAR); CREATE TABLE swimmer (name VARCHAR, id VARCHAR) |
### question: Find the names of stadiums that some Australian swimmers have been to. ### answer: 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' ### 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) |
### question: Find the names of stadiums that the most swimmers have been to. ### answer: 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 ### context: CREATE TABLE record (event_id VARCHAR); CREATE TABLE stadium (name VARCHAR, id VARCHAR); CREATE TABLE event (stadium_id VARCHAR, id VARCHAR) |
### question: Find all details for each swimmer. ### answer: SELECT * FROM swimmer ### context: CREATE TABLE swimmer (Id VARCHAR) |
### question: What is the average capacity of the stadiums that were opened in year 2005? ### answer: SELECT AVG(capacity) FROM stadium WHERE opening_year = 2005 ### context: CREATE TABLE stadium (capacity INTEGER, opening_year VARCHAR) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.