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