db_id
stringclasses
140 values
question
stringlengths
16
224
query
stringlengths
18
577
db_schema
stringclasses
140 values
question_toks
listlengths
4
44
products_gen_characteristics
How many colors are never used by any product?
SELECT count(*) FROM Ref_colors WHERE color_code NOT IN ( SELECT color_code FROM products )
Ref_Characteristic_Types: characteristic_type_code (text), characteristic_type_description (text) | Ref_Colors: color_code (text), color_description (text) | Ref_Product_Categories: product_category_code (text), product_category_description (text), unit_of_measure (text) | Characteristics: characteristic_id (number), c...
[ "How", "many", "colors", "are", "never", "used", "by", "any", "product", "?" ]
products_gen_characteristics
Count the number of colors that are not used in any products.
SELECT count(*) FROM Ref_colors WHERE color_code NOT IN ( SELECT color_code FROM products )
Ref_Characteristic_Types: characteristic_type_code (text), characteristic_type_description (text) | Ref_Colors: color_code (text), color_description (text) | Ref_Product_Categories: product_category_code (text), product_category_description (text), unit_of_measure (text) | Characteristics: characteristic_id (number), c...
[ "Count", "the", "number", "of", "colors", "that", "are", "not", "used", "in", "any", "products", "." ]
swimming
How many events are there?
SELECT count(*) FROM event
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "How", "many", "events", "are", "there", "?" ]
swimming
List all the event names by year from the most recent to the oldest.
SELECT name FROM event ORDER BY YEAR DESC
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "List", "all", "the", "event", "names", "by", "year", "from", "the", "most", "recent", "to", "the", "oldest", "." ]
swimming
What is the name of the event that happened in the most recent year?
SELECT name FROM event ORDER BY YEAR DESC LIMIT 1
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "What", "is", "the", "name", "of", "the", "event", "that", "happened", "in", "the", "most", "recent", "year", "?" ]
swimming
How many stadiums are there?
SELECT count(*) FROM stadium
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "How", "many", "stadiums", "are", "there", "?" ]
swimming
Find the name of the stadium that has the maximum capacity.
SELECT name FROM stadium ORDER BY capacity DESC LIMIT 1
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "name", "of", "the", "stadium", "that", "has", "the", "maximum", "capacity", "." ]
swimming
Find the names of stadiums whose capacity is smaller than the average capacity.
SELECT name FROM stadium WHERE capacity < (SELECT avg(capacity) FROM stadium)
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "names", "of", "stadiums", "whose", "capacity", "is", "smaller", "than", "the", "average", "capacity", "." ]
swimming
Find the country that has the most stadiums.
SELECT country FROM stadium GROUP BY country ORDER BY count(*) DESC LIMIT 1
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "country", "that", "has", "the", "most", "stadiums", "." ]
swimming
Which country has at most 3 stadiums listed?
SELECT country FROM stadium GROUP BY country HAVING count(*) <= 3
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Which", "country", "has", "at", "most", "3", "stadiums", "listed", "?" ]
swimming
Which country has both stadiums with capacity greater than 60000 and stadiums with capacity less than 50000?
SELECT country FROM stadium WHERE capacity > 60000 INTERSECT SELECT country FROM stadium WHERE capacity < 50000
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Which", "country", "has", "both", "stadiums", "with", "capacity", "greater", "than", "60000", "and", "stadiums", "with", "capacity", "less", "than", "50000", "?" ]
swimming
How many cities have a stadium that was opened before the year of 2006?
SELECT count(DISTINCT city) FROM stadium WHERE opening_year < 2006
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "How", "many", "cities", "have", "a", "stadium", "that", "was", "opened", "before", "the", "year", "of", "2006", "?" ]
swimming
How many stadiums does each country have?
SELECT country , count(*) FROM stadium GROUP BY country
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "How", "many", "stadiums", "does", "each", "country", "have", "?" ]
swimming
Which countries do not have a stadium that was opened after 2006?
SELECT country FROM stadium EXCEPT SELECT country FROM stadium WHERE opening_year > 2006
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Which", "countries", "do", "not", "have", "a", "stadium", "that", "was", "opened", "after", "2006", "?" ]
swimming
How many stadiums are not in country "Russia"?
SELECT count(*) FROM stadium WHERE country != 'Russia'
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "How", "many", "stadiums", "are", "not", "in", "country", "``", "Russia", "''", "?" ]
swimming
Find the names of all swimmers, sorted by their 100 meter scores in ascending order.
SELECT name FROM swimmer ORDER BY meter_100
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "names", "of", "all", "swimmers", ",", "sorted", "by", "their", "100", "meter", "scores", "in", "ascending", "order", "." ]
swimming
How many different countries are all the swimmers from?
SELECT count(DISTINCT nationality) FROM swimmer
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "How", "many", "different", "countries", "are", "all", "the", "swimmers", "from", "?" ]
swimming
List countries that have more than one swimmer.
SELECT nationality , count(*) FROM swimmer GROUP BY nationality HAVING count(*) > 1
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "List", "countries", "that", "have", "more", "than", "one", "swimmer", "." ]
swimming
Find all 200 meter and 300 meter results of swimmers with nationality "Australia".
SELECT meter_200 , meter_300 FROM swimmer WHERE nationality = 'Australia'
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "all", "200", "meter", "and", "300", "meter", "results", "of", "swimmers", "with", "nationality", "``", "Australia", "''", "." ]
swimming
Find the names of swimmers who has a result of "win".
SELECT t1.name FROM swimmer AS t1 JOIN record AS t2 ON t1.id = t2.swimmer_id WHERE RESULT = 'Win'
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "names", "of", "swimmers", "who", "has", "a", "result", "of", "``", "win", "''", "." ]
swimming
What is the name of the stadium which held the most events?
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
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "What", "is", "the", "name", "of", "the", "stadium", "which", "held", "the", "most", "events", "?" ]
swimming
Find the name and capacity of the stadium where the event named "World Junior" happened.
SELECT t1.name , t1.capacity FROM stadium AS t1 JOIN event AS t2 ON t1.id = t2.stadium_id WHERE t2.name = 'World Junior'
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "name", "and", "capacity", "of", "the", "stadium", "where", "the", "event", "named", "``", "World", "Junior", "''", "happened", "." ]
swimming
Find the names of stadiums which have never had any event.
SELECT name FROM stadium WHERE id NOT IN (SELECT stadium_id FROM event)
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "names", "of", "stadiums", "which", "have", "never", "had", "any", "event", "." ]
swimming
Find the name of the swimmer who has the most records.
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
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "name", "of", "the", "swimmer", "who", "has", "the", "most", "records", "." ]
swimming
Find the name of the swimmer who has at least 2 records.
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
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "name", "of", "the", "swimmer", "who", "has", "at", "least", "2", "records", "." ]
swimming
Find the name and nationality of the swimmer who has won (i.e., has a result of "win") more than 1 time.
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
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "name", "and", "nationality", "of", "the", "swimmer", "who", "has", "won", "(", "i.e.", ",", "has", "a", "result", "of", "``", "win", "''", ")", "more", "than", "1", "time", "." ]
swimming
Find the names of the swimmers who have no record.
SELECT name FROM swimmer WHERE id NOT IN (SELECT swimmer_id FROM record)
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "names", "of", "the", "swimmers", "who", "have", "no", "record", "." ]
swimming
Find the names of the swimmers who have both "win" and "loss" results in the record.
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'
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "names", "of", "the", "swimmers", "who", "have", "both", "``", "win", "''", "and", "``", "loss", "''", "results", "in", "the", "record", "." ]
swimming
Find the names of stadiums that some Australian swimmers have been to.
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'
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "names", "of", "stadiums", "that", "some", "Australian", "swimmers", "have", "been", "to", "." ]
swimming
Find the names of stadiums that the most swimmers have been to.
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
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "the", "names", "of", "stadiums", "that", "the", "most", "swimmers", "have", "been", "to", "." ]
swimming
Find all details for each swimmer.
SELECT * FROM swimmer
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "Find", "all", "details", "for", "each", "swimmer", "." ]
swimming
What is the average capacity of the stadiums that were opened in year 2005?
SELECT avg(capacity) FROM stadium WHERE opening_year = 2005
swimmer: ID (number), name (text), Nationality (text), meter_100 (number), meter_200 (text), meter_300 (text), meter_400 (text), meter_500 (text), meter_600 (text), meter_700 (text), Time (text) | stadium: ID (number), name (text), Capacity (number), City (text), Country (text), Opening_year (number) | event: ID (numbe...
[ "What", "is", "the", "average", "capacity", "of", "the", "stadiums", "that", "were", "opened", "in", "year", "2005", "?" ]
railway
How many railways are there?
SELECT count(*) FROM railway
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "How", "many", "railways", "are", "there", "?" ]
railway
List the builders of railways in ascending alphabetical order.
SELECT Builder FROM railway ORDER BY Builder ASC
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "List", "the", "builders", "of", "railways", "in", "ascending", "alphabetical", "order", "." ]
railway
List the wheels and locations of the railways.
SELECT Wheels , LOCATION FROM railway
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "List", "the", "wheels", "and", "locations", "of", "the", "railways", "." ]
railway
What is the maximum level of managers in countries that are not "Australia"?
SELECT max(LEVEL) FROM manager WHERE Country != "Australia "
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "What", "is", "the", "maximum", "level", "of", "managers", "in", "countries", "that", "are", "not", "``", "Australia", "''", "?" ]
railway
What is the average age for all managers?
SELECT avg(Age) FROM manager
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "What", "is", "the", "average", "age", "for", "all", "managers", "?" ]
railway
What are the names of managers in ascending order of level?
SELECT Name FROM manager ORDER BY LEVEL ASC
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "What", "are", "the", "names", "of", "managers", "in", "ascending", "order", "of", "level", "?" ]
railway
What are the names and arrival times of trains?
SELECT Name , Arrival FROM train
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "What", "are", "the", "names", "and", "arrival", "times", "of", "trains", "?" ]
railway
What is the name of the oldest manager?
SELECT Name FROM manager ORDER BY Age DESC LIMIT 1
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "What", "is", "the", "name", "of", "the", "oldest", "manager", "?" ]
railway
Show the names of trains and locations of railways they are in.
SELECT T2.Name , T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "Show", "the", "names", "of", "trains", "and", "locations", "of", "railways", "they", "are", "in", "." ]
railway
Show the builder of railways associated with the trains named "Andaman Exp".
SELECT T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID WHERE T2.Name = "Andaman Exp"
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "Show", "the", "builder", "of", "railways", "associated", "with", "the", "trains", "named", "``", "Andaman", "Exp", "''", "." ]
railway
Show id and location of railways that are associated with more than one train.
SELECT T2.Railway_ID , T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID HAVING COUNT(*) > 1
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "Show", "id", "and", "location", "of", "railways", "that", "are", "associated", "with", "more", "than", "one", "train", "." ]
railway
Show the id and builder of the railway that are associated with the most trains.
SELECT T2.Railway_ID , T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID ORDER BY COUNT(*) DESC LIMIT 1
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "Show", "the", "id", "and", "builder", "of", "the", "railway", "that", "are", "associated", "with", "the", "most", "trains", "." ]
railway
Show different builders of railways, along with the corresponding number of railways using each builder.
SELECT Builder , COUNT(*) FROM railway GROUP BY Builder
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "Show", "different", "builders", "of", "railways", ",", "along", "with", "the", "corresponding", "number", "of", "railways", "using", "each", "builder", "." ]
railway
Show the most common builder of railways.
SELECT Builder FROM railway GROUP BY Builder ORDER BY COUNT(*) DESC LIMIT 1
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "Show", "the", "most", "common", "builder", "of", "railways", "." ]
railway
Show different locations of railways along with the corresponding number of railways at each location.
SELECT LOCATION , COUNT(*) FROM railway GROUP BY LOCATION
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "Show", "different", "locations", "of", "railways", "along", "with", "the", "corresponding", "number", "of", "railways", "at", "each", "location", "." ]
railway
Show the locations that have more than one railways.
SELECT LOCATION FROM railway GROUP BY LOCATION HAVING COUNT(*) > 1
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "Show", "the", "locations", "that", "have", "more", "than", "one", "railways", "." ]
railway
List the object number of railways that do not have any trains.
SELECT ObjectNumber FROM railway WHERE Railway_ID NOT IN (SELECT Railway_ID FROM train)
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "List", "the", "object", "number", "of", "railways", "that", "do", "not", "have", "any", "trains", "." ]
railway
Show the countries that have both managers of age above 50 and managers of age below 46.
SELECT Country FROM manager WHERE Age > 50 INTERSECT SELECT Country FROM manager WHERE Age < 46
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "Show", "the", "countries", "that", "have", "both", "managers", "of", "age", "above", "50", "and", "managers", "of", "age", "below", "46", "." ]
railway
Show the distinct countries of managers.
SELECT DISTINCT Country FROM manager
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "Show", "the", "distinct", "countries", "of", "managers", "." ]
railway
Show the working years of managers in descending order of their level.
SELECT Working_year_starts FROM manager ORDER BY LEVEL DESC
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "Show", "the", "working", "years", "of", "managers", "in", "descending", "order", "of", "their", "level", "." ]
railway
Show the countries that have managers of age above 50 or below 46.
SELECT Country FROM manager WHERE Age > 50 OR Age < 46
railway: Railway_ID (number), Railway (text), Builder (text), Built (text), Wheels (text), Location (text), ObjectNumber (text) | train: Train_ID (number), Train_Num (text), Name (text), From (text), Arrival (text), Railway_ID (number) | manager: Manager_ID (number), Name (text), Country (text), Working_year_starts (te...
[ "Show", "the", "countries", "that", "have", "managers", "of", "age", "above", "50", "or", "below", "46", "." ]
customers_and_products_contacts
How many addresses are there in country USA?
SELECT count(*) FROM addresses WHERE country = 'USA'
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "How", "many", "addresses", "are", "there", "in", "country", "USA", "?" ]
customers_and_products_contacts
Show all distinct cities in the address record.
SELECT DISTINCT city FROM addresses
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "Show", "all", "distinct", "cities", "in", "the", "address", "record", "." ]
customers_and_products_contacts
Show each state and the number of addresses in each state.
SELECT state_province_county , count(*) FROM addresses GROUP BY state_province_county
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "Show", "each", "state", "and", "the", "number", "of", "addresses", "in", "each", "state", "." ]
customers_and_products_contacts
Show names and phones of customers who do not have address information.
SELECT customer_name , customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM customer_address_history)
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "Show", "names", "and", "phones", "of", "customers", "who", "do", "not", "have", "address", "information", "." ]
customers_and_products_contacts
Show the name of the customer who has the most orders.
SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "Show", "the", "name", "of", "the", "customer", "who", "has", "the", "most", "orders", "." ]
customers_and_products_contacts
Show the product type codes which have at least two products.
SELECT product_type_code FROM products GROUP BY product_type_code HAVING count(*) >= 2
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "Show", "the", "product", "type", "codes", "which", "have", "at", "least", "two", "products", "." ]
customers_and_products_contacts
Show the names of customers who have both an order in completed status and an order in part status.
SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Completed' INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status_code = 'Part'
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "Show", "the", "names", "of", "customers", "who", "have", "both", "an", "order", "in", "completed", "status", "and", "an", "order", "in", "part", "status", "." ]
customers_and_products_contacts
Show the name, phone, and payment method code for all customers in descending order of customer number.
SELECT customer_name , customer_phone , payment_method_code FROM customers ORDER BY customer_number DESC
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "Show", "the", "name", ",", "phone", ",", "and", "payment", "method", "code", "for", "all", "customers", "in", "descending", "order", "of", "customer", "number", "." ]
customers_and_products_contacts
Show the product name and total order quantity for each product.
SELECT T1.product_name , sum(T2.order_quantity) FROM products AS T1 JOIN order_items AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_id
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "Show", "the", "product", "name", "and", "total", "order", "quantity", "for", "each", "product", "." ]
customers_and_products_contacts
Show the minimum, maximum, average price for all products.
SELECT min(product_price) , max(product_price) , avg(product_price) FROM products
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "Show", "the", "minimum", ",", "maximum", ",", "average", "price", "for", "all", "products", "." ]
customers_and_products_contacts
How many products have a price higher than the average?
SELECT count(*) FROM products WHERE product_price > (SELECT avg(product_price) FROM products)
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "How", "many", "products", "have", "a", "price", "higher", "than", "the", "average", "?" ]
customers_and_products_contacts
Show the customer name, customer address city, date from, and date to for each customer address history.
SELECT T2.customer_name , T3.city , T1.date_from , T1.date_to FROM customer_address_history AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id JOIN addresses AS T3 ON T1.address_id = T3.address_id
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "Show", "the", "customer", "name", ",", "customer", "address", "city", ",", "date", "from", ",", "and", "date", "to", "for", "each", "customer", "address", "history", "." ]
customers_and_products_contacts
Show the names of customers who use Credit Card payment method and have more than 2 orders.
SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_method_code = 'Credit Card' GROUP BY T1.customer_id HAVING count(*) > 2
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "Show", "the", "names", "of", "customers", "who", "use", "Credit", "Card", "payment", "method", "and", "have", "more", "than", "2", "orders", "." ]
customers_and_products_contacts
What are the name and phone of the customer with the most ordered product quantity?
SELECT T1.customer_name , T1.customer_phone FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id = T2.customer_id JOIN order_items AS T3 ON T3.order_id = T2.order_id GROUP BY T1.customer_id ORDER BY sum(T3.order_quantity) DESC LIMIT 1
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "What", "are", "the", "name", "and", "phone", "of", "the", "customer", "with", "the", "most", "ordered", "product", "quantity", "?" ]
customers_and_products_contacts
Show the product type and name for the products with price higher than 1000 or lower than 500.
SELECT product_type_code , product_name FROM products WHERE product_price > 1000 OR product_price < 500
Addresses: address_id (number), line_1_number_building (text), city (text), zip_postcode (text), state_province_county (text), country (text) | Products: product_id (number), product_type_code (text), product_name (text), product_price (number) | Customers: customer_id (number), payment_method_code (text), customer_num...
[ "Show", "the", "product", "type", "and", "name", "for", "the", "products", "with", "price", "higher", "than", "1000", "or", "lower", "than", "500", "." ]
dorm_1
Find the name of dorms only for female (F gender).
SELECT dorm_name FROM dorm WHERE gender = 'F'
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "Find", "the", "name", "of", "dorms", "only", "for", "female", "(", "F", "gender", ")", "." ]
dorm_1
What are the names of the all-female dorms?
SELECT dorm_name FROM dorm WHERE gender = 'F'
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "What", "are", "the", "names", "of", "the", "all-female", "dorms", "?" ]
dorm_1
Find the name of dorms that can accommodate more than 300 students.
SELECT dorm_name FROM dorm WHERE student_capacity > 300
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "Find", "the", "name", "of", "dorms", "that", "can", "accommodate", "more", "than", "300", "students", "." ]
dorm_1
What are the names of all the dorms that can accomdate more than 300 students?
SELECT dorm_name FROM dorm WHERE student_capacity > 300
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "What", "are", "the", "names", "of", "all", "the", "dorms", "that", "can", "accomdate", "more", "than", "300", "students", "?" ]
dorm_1
How many female students (sex is F) whose age is below 25?
SELECT count(*) FROM student WHERE sex = 'F' AND age < 25
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "How", "many", "female", "students", "(", "sex", "is", "F", ")", "whose", "age", "is", "below", "25", "?" ]
dorm_1
How many girl students who are younger than 25?
SELECT count(*) FROM student WHERE sex = 'F' AND age < 25
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "How", "many", "girl", "students", "who", "are", "younger", "than", "25", "?" ]
dorm_1
Find the first name of students who is older than 20.
SELECT fname FROM student WHERE age > 20
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "Find", "the", "first", "name", "of", "students", "who", "is", "older", "than", "20", "." ]
dorm_1
What are the first names of all students who are older than 20?
SELECT fname FROM student WHERE age > 20
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "What", "are", "the", "first", "names", "of", "all", "students", "who", "are", "older", "than", "20", "?" ]
dorm_1
Find the first name of students living in city PHL whose age is between 20 and 25.
SELECT fname FROM student WHERE city_code = 'PHL' AND age BETWEEN 20 AND 25
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "Find", "the", "first", "name", "of", "students", "living", "in", "city", "PHL", "whose", "age", "is", "between", "20", "and", "25", "." ]
dorm_1
What is the first name of the students who are in age 20 to 25 and living in PHL city?
SELECT fname FROM student WHERE city_code = 'PHL' AND age BETWEEN 20 AND 25
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "What", "is", "the", "first", "name", "of", "the", "students", "who", "are", "in", "age", "20", "to", "25", "and", "living", "in", "PHL", "city", "?" ]
dorm_1
How many dorms are there?
SELECT count(*) FROM dorm
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "How", "many", "dorms", "are", "there", "?" ]
dorm_1
How many dorms are in the database?
SELECT count(*) FROM dorm
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "How", "many", "dorms", "are", "in", "the", "database", "?" ]
dorm_1
Find the number of distinct amenities.
SELECT count(*) FROM dorm_amenity
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "Find", "the", "number", "of", "distinct", "amenities", "." ]
dorm_1
How many diffrent dorm amenities are there?
SELECT count(*) FROM dorm_amenity
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "How", "many", "diffrent", "dorm", "amenities", "are", "there", "?" ]
dorm_1
Find the total capacity of all dorms.
SELECT sum(student_capacity) FROM dorm
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "Find", "the", "total", "capacity", "of", "all", "dorms", "." ]
dorm_1
What is the total student capacity of all dorms?
SELECT sum(student_capacity) FROM dorm
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "What", "is", "the", "total", "student", "capacity", "of", "all", "dorms", "?" ]
dorm_1
How many students are there?
SELECT count(*) FROM student
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "How", "many", "students", "are", "there", "?" ]
dorm_1
How many students exist?
SELECT count(*) FROM student
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "How", "many", "students", "exist", "?" ]
dorm_1
Find the average age of all students living in the each city.
SELECT avg(age) , city_code FROM student GROUP BY city_code
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "Find", "the", "average", "age", "of", "all", "students", "living", "in", "the", "each", "city", "." ]
dorm_1
What is the average age for each city and what are those cities?
SELECT avg(age) , city_code FROM student GROUP BY city_code
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "What", "is", "the", "average", "age", "for", "each", "city", "and", "what", "are", "those", "cities", "?" ]
dorm_1
Find the average and total capacity of dorms for the students with gender X.
SELECT avg(student_capacity) , sum(student_capacity) FROM dorm WHERE gender = 'X'
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "Find", "the", "average", "and", "total", "capacity", "of", "dorms", "for", "the", "students", "with", "gender", "X", "." ]
dorm_1
What is the average and total capacity for all dorms who are of gender X?
SELECT avg(student_capacity) , sum(student_capacity) FROM dorm WHERE gender = 'X'
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "What", "is", "the", "average", "and", "total", "capacity", "for", "all", "dorms", "who", "are", "of", "gender", "X", "?" ]
dorm_1
Find the number of dorms that have some amenity.
SELECT count(DISTINCT dormid) FROM has_amenity
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "Find", "the", "number", "of", "dorms", "that", "have", "some", "amenity", "." ]
dorm_1
How many dorms have amenities?
SELECT count(DISTINCT dormid) FROM has_amenity
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "How", "many", "dorms", "have", "amenities", "?" ]
dorm_1
Find the name of dorms that do not have any amenity
SELECT dorm_name FROM dorm WHERE dormid NOT IN (SELECT dormid FROM has_amenity)
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "Find", "the", "name", "of", "dorms", "that", "do", "not", "have", "any", "amenity" ]
dorm_1
What are the names of all the dorms that don't have any amenities?
SELECT dorm_name FROM dorm WHERE dormid NOT IN (SELECT dormid FROM has_amenity)
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "What", "are", "the", "names", "of", "all", "the", "dorms", "that", "do", "n't", "have", "any", "amenities", "?" ]
dorm_1
Find the number of distinct gender for dorms.
SELECT count(DISTINCT gender) FROM dorm
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "Find", "the", "number", "of", "distinct", "gender", "for", "dorms", "." ]
dorm_1
How many different genders are there in the dorms?
SELECT count(DISTINCT gender) FROM dorm
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "How", "many", "different", "genders", "are", "there", "in", "the", "dorms", "?" ]
dorm_1
Find the capacity and gender type of the dorm whose name has substring ‘Donor’.
SELECT student_capacity , gender FROM dorm WHERE dorm_name LIKE '%Donor%'
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "Find", "the", "capacity", "and", "gender", "type", "of", "the", "dorm", "whose", "name", "has", "substring", "‘Donor’", "." ]
dorm_1
What is the student capacity and type of gender for the dorm whose name as the phrase Donor in it?
SELECT student_capacity , gender FROM dorm WHERE dorm_name LIKE '%Donor%'
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "What", "is", "the", "student", "capacity", "and", "type", "of", "gender", "for", "the", "dorm", "whose", "name", "as", "the", "phrase", "Donor", "in", "it", "?" ]
dorm_1
Find the name and gender type of the dorms whose capacity is greater than 300 or less than 100.
SELECT dorm_name , gender FROM dorm WHERE student_capacity > 300 OR student_capacity < 100
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "Find", "the", "name", "and", "gender", "type", "of", "the", "dorms", "whose", "capacity", "is", "greater", "than", "300", "or", "less", "than", "100", "." ]
dorm_1
What are the names and types of the dorms that have a capacity greater than 300 or less than 100?
SELECT dorm_name , gender FROM dorm WHERE student_capacity > 300 OR student_capacity < 100
Student: StuID (number), LName (text), Fname (text), Age (number), Sex (text), Major (number), Advisor (number), city_code (text) | Dorm: dormid (number), dorm_name (text), student_capacity (number), gender (text) | Dorm_amenity: amenid (number), amenity_name (text) | Has_amenity: dormid (number), amenid (number) | Liv...
[ "What", "are", "the", "names", "and", "types", "of", "the", "dorms", "that", "have", "a", "capacity", "greater", "than", "300", "or", "less", "than", "100", "?" ]