nl
stringlengths
22
185
sql
stringlengths
22
608
db_id
stringclasses
40 values
table_schema
stringclasses
305 values
How many reservations for each boat did the sailors with an id greater than 1 make?
SELECT bid , count(*) FROM Reserves WHERE sid > 1 GROUP BY bid
boat_1
[{'table_name': 'reserves', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'boat id'}, {'col_name': 'day'}], 'foreign_key_columns': ['boat id', 'sailor id'], 'primary_keys': []}]
What is the rating and average age for sailors who have reserved red boat grouped by rating?
SELECT T1.rating , avg(T1.age) FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid JOIN Boats AS T3 ON T3.bid = T2.bid WHERE T3.color = 'red' GROUP BY T1.rating
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_k...
What are the rating and average age for sailors who reserved red boats for each rating?
SELECT T1.rating , avg(T1.age) FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid JOIN Boats AS T3 ON T3.bid = T2.bid WHERE T3.color = 'red' GROUP BY T1.rating
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_k...
Find the name, rating and age of all sailors ordered by rating and age.
SELECT name , rating , age FROM Sailors ORDER BY rating , age
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}]
What is the name, rating, and age for every sailor? And order them by rating and age.
SELECT name , rating , age FROM Sailors ORDER BY rating , age
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}]
Find the total number of boats.
SELECT count(*) FROM Boats
boat_1
[{'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_key_columns': [], 'primary_keys': ['boat id']}]
How many boats are there?
SELECT count(*) FROM Boats
boat_1
[{'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_key_columns': [], 'primary_keys': ['boat id']}]
How many boats are red?
SELECT count(*) FROM Boats WHERE color = 'red'
boat_1
[{'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_key_columns': [], 'primary_keys': ['boat id']}]
How many red boats exist?
SELECT count(*) FROM Boats WHERE color = 'red'
boat_1
[{'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_key_columns': [], 'primary_keys': ['boat id']}]
Find the names of boats booked by sailors whose age is between 20 and 30.
SELECT T3.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid JOIN Boats AS T3 ON T3.bid = T2.bid WHERE T1.age BETWEEN 20 AND 30
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_k...
What are the names of the boats booked by people between age 20 and 30?
SELECT T3.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid JOIN Boats AS T3 ON T3.bid = T2.bid WHERE T1.age BETWEEN 20 AND 30
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_k...
Find the names of sailors whose rating is larger than the rating of all sailors who booked a red boat.
SELECT name FROM Sailors WHERE rating > (SELECT max(T1.rating) FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid JOIN Boats AS T3 ON T3.bid = T2.bid WHERE T3.color = 'red')
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_k...
What are the names of the sailors whose rating is larger than the rating of all sailors who booked a red boat?
SELECT name FROM Sailors WHERE rating > (SELECT max(T1.rating) FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid JOIN Boats AS T3 ON T3.bid = T2.bid WHERE T3.color = 'red')
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_k...
What is highest rating between sailors?
SELECT max(rating) FROM Sailors
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}]
What is the maximum rating for sailors?
SELECT max(rating) FROM Sailors
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}]
Find the names of sailors who reserved boat with the name Melon.
SELECT T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid JOIN Boats AS T3 ON T3.bid = T2.bid WHERE T3.name = 'Melon'
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_k...
What are the names of sailors who reserved a boat with the name Melon?
SELECT T1.name FROM Sailors AS T1 JOIN Reserves AS T2 ON T1.sid = T2.sid JOIN Boats AS T3 ON T3.bid = T2.bid WHERE T3.name = 'Melon'
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}, {'table_name': 'boats', 'table_schema': [{'col_name': 'boat id'}, {'col_name': 'name'}, {'col_name': 'color'}], 'foreign_k...
List the names and ages of all sailors sorted by rating in descending order.
SELECT name , age FROM Sailors ORDER BY rating DESC
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}]
What are the names and ages of all sailors sorted by decreasing rating?
SELECT name , age FROM Sailors ORDER BY rating DESC
boat_1
[{'table_name': 'sailors', 'table_schema': [{'col_name': 'sailor id'}, {'col_name': 'name'}, {'col_name': 'rating'}, {'col_name': 'age'}], 'foreign_key_columns': [], 'primary_keys': ['sailor id']}]
Find the model of the most expensive headphone.
SELECT model FROM headphone ORDER BY price DESC LIMIT 1
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Which headphone model has the highest price?
SELECT model FROM headphone ORDER BY price DESC LIMIT 1
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
List all different headphone models in the alphabetical order.
SELECT DISTINCT model FROM headphone ORDER BY model
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Return the list of distinct headphone models ordered alphabetically.
SELECT DISTINCT model FROM headphone ORDER BY model
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Which headphone class is the most common one?
SELECT CLASS FROM headphone GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Which headphone class contains the most headphones?
SELECT CLASS FROM headphone GROUP BY CLASS ORDER BY count(*) DESC LIMIT 1
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Which headphone class does have more than two headphones?
SELECT CLASS FROM headphone GROUP BY CLASS HAVING count(*) > 2
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Find the headphone class that does not contain more than two headphones.
SELECT CLASS FROM headphone GROUP BY CLASS HAVING count(*) > 2
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Find the number of headphones with a price higher than 200 for each class.
SELECT count(*) , CLASS FROM headphone WHERE price > 200 GROUP BY CLASS
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
How many headphones cost more than 200 for each headphone class?
SELECT count(*) , CLASS FROM headphone WHERE price > 200 GROUP BY CLASS
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
how many different earpads are there?
SELECT count(DISTINCT earpads) FROM headphone
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Count the number of different earpads.
SELECT count(DISTINCT earpads) FROM headphone
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Find the top 2 earpads that are mostly used.
SELECT earpads FROM headphone GROUP BY earpads ORDER BY count(*) DESC LIMIT 2
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
What are the top 2 earpads in terms of the number of headphones using them?
SELECT earpads FROM headphone GROUP BY earpads ORDER BY count(*) DESC LIMIT 2
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
What are the model, class, and construction of the cheapest headphone?
SELECT model , CLASS , construction FROM headphone ORDER BY price LIMIT 1
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Find the model, class, and construction of the headphone with the lowest price.
SELECT model , CLASS , construction FROM headphone ORDER BY price LIMIT 1
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Find the average price for each headphone construction.
SELECT construction , avg(price) FROM headphone GROUP BY construction
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
How much does headphones cost on average for each headphone construction?
SELECT construction , avg(price) FROM headphone GROUP BY construction
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Which headphone classes have both headphones with "Bowls" and headphones with "Comfort Pads" earpads?
SELECT CLASS FROM headphone WHERE earpads = 'Bowls' INTERSECT SELECT CLASS FROM headphone WHERE earpads = 'Comfort Pads'
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Find the headphone classes that contain both headphones using "Bowls" earpads and headphones using "Comfort Pads" earpads.
SELECT CLASS FROM headphone WHERE earpads = 'Bowls' INTERSECT SELECT CLASS FROM headphone WHERE earpads = 'Comfort Pads'
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Which earpads never use plastic construction?
SELECT earpads FROM headphone EXCEPT SELECT earpads FROM headphone WHERE construction = 'Plastic'
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Find all earpads that do not use plastic construction.
SELECT earpads FROM headphone EXCEPT SELECT earpads FROM headphone WHERE construction = 'Plastic'
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Find the headphone models whose price is below the average price.
SELECT model FROM headphone WHERE price < (SELECT avg(price) FROM headphone)
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
What are the headphone models that cost less than the average price?
SELECT model FROM headphone WHERE price < (SELECT avg(price) FROM headphone)
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}]
Sort all store names by store open date.
SELECT name FROM store ORDER BY date_opened
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}]
Give me a list of store names, sorted by store open date.
SELECT name FROM store ORDER BY date_opened
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}]
List name and parking info for the stores in the Tarzana neighborhood.
SELECT name , parking FROM store WHERE neighborhood = 'Tarzana'
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}]
Which stores are located in the "Tarzana" neighborhood? Return their names and parking information.
SELECT name , parking FROM store WHERE neighborhood = 'Tarzana'
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}]
How many different neighborhoods are there for all stores?
SELECT count(DISTINCT neighborhood) FROM store
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}]
Count the number of distinct neighborhoods stores are located.
SELECT count(DISTINCT neighborhood) FROM store
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}]
find the number of stores in each neighborhood.
SELECT count(*) , neighborhood FROM store GROUP BY neighborhood
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}]
How many stores are there in each neighborhood?
SELECT count(*) , neighborhood FROM store GROUP BY neighborhood
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}]
Find the name of the store which has the most headphones in stock. List the number of headphones as well.
SELECT t1.name , sum(t2.quantity) FROM store AS t1 JOIN stock AS t2 ON t1.store_id = t2.store_id GROUP BY t2.store_id ORDER BY sum(t2.quantity) DESC LIMIT 1
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}, {'table_name': 'stock', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'headph...
Which store has the headphones in stock? Give me the store name and the total quantity.
SELECT t1.name , sum(t2.quantity) FROM store AS t1 JOIN stock AS t2 ON t1.store_id = t2.store_id GROUP BY t2.store_id ORDER BY sum(t2.quantity) DESC LIMIT 1
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}, {'table_name': 'stock', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'headph...
Find the name of stores which have no headphone in stock.
SELECT name FROM store WHERE store_id NOT IN (SELECT store_id FROM stock)
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}, {'table_name': 'stock', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'headph...
Which stores do not have any headphones in stock? Give me the store names.
SELECT name FROM store WHERE store_id NOT IN (SELECT store_id FROM stock)
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}, {'table_name': 'stock', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'headph...
Which headphone models do not have any stock in any store?
SELECT model FROM headphone WHERE headphone_id NOT IN (SELECT headphone_id FROM stock)
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}, {'table_name': 'stock'...
Find the headphone models that are not in stock in any store.
SELECT model FROM headphone WHERE headphone_id NOT IN (SELECT headphone_id FROM stock)
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}, {'table_name': 'stock'...
Which headphone model has the largest quantity of stock across all the stores?
SELECT t1.model FROM headphone AS t1 JOIN stock AS t2 ON t1.headphone_id = t2.headphone_id GROUP BY t1.model ORDER BY sum(t2.quantity) DESC LIMIT 1
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}, {'table_name': 'stock'...
Find the headphone model whose total quantity in stock is the largest.
SELECT t1.model FROM headphone AS t1 JOIN stock AS t2 ON t1.headphone_id = t2.headphone_id GROUP BY t1.model ORDER BY sum(t2.quantity) DESC LIMIT 1
headphone_store
[{'table_name': 'headphone', 'table_schema': [{'col_name': 'headphone id'}, {'col_name': 'model'}, {'col_name': 'class'}, {'col_name': 'driver-matched db'}, {'col_name': 'construction'}, {'col_name': 'earpads'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['headphone id']}, {'table_name': 'stock'...
How many headphones are stored in the Woodman store?
SELECT sum(t2.quantity) FROM store AS t1 JOIN stock AS t2 ON t1.store_id = t2.store_id WHERE t1.name = 'Woodman'
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}, {'table_name': 'stock', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'headph...
Find the total quantity of headphones stored in the Woodman store.
SELECT sum(t2.quantity) FROM store AS t1 JOIN stock AS t2 ON t1.store_id = t2.store_id WHERE t1.name = 'Woodman'
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}, {'table_name': 'stock', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'headph...
Which neighborhood does not have any headphone in stock?
SELECT Neighborhood FROM store EXCEPT SELECT t1.Neighborhood FROM store AS t1 JOIN stock AS t2 ON t1.store_id = t2.store_id
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}, {'table_name': 'stock', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'headph...
Find the neighborhood where no headphones are in stock.
SELECT Neighborhood FROM store EXCEPT SELECT t1.Neighborhood FROM store AS t1 JOIN stock AS t2 ON t1.store_id = t2.store_id
headphone_store
[{'table_name': 'store', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'name'}, {'col_name': 'neighborhood'}, {'col_name': 'parking'}, {'col_name': 'date opened'}], 'foreign_key_columns': [], 'primary_keys': ['store id']}, {'table_name': 'stock', 'table_schema': [{'col_name': 'store id'}, {'col_name': 'headph...
How many authors do we have?
SELECT count(*) FROM Author
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}]
Count the number of authors.
SELECT count(*) FROM Author
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}]
How many papers do we have?
SELECT count(*) FROM Paper
aan_1
[{'table_name': 'paper', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'title'}, {'col_name': 'venue'}, {'col_name': 'year'}], 'foreign_key_columns': [], 'primary_keys': ['paper id']}]
Count the number of papers.
SELECT count(*) FROM Paper
aan_1
[{'table_name': 'paper', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'title'}, {'col_name': 'venue'}, {'col_name': 'year'}], 'foreign_key_columns': [], 'primary_keys': ['paper id']}]
How many affiliations do we have?
SELECT count(*) FROM Affiliation
aan_1
[{'table_name': 'affiliation', 'table_schema': [{'col_name': 'affiliation id'}, {'col_name': 'name'}, {'col_name': 'address'}], 'foreign_key_columns': [], 'primary_keys': ['affiliation id']}]
Count the number of affiliations.
SELECT count(*) FROM Affiliation
aan_1
[{'table_name': 'affiliation', 'table_schema': [{'col_name': 'affiliation id'}, {'col_name': 'name'}, {'col_name': 'address'}], 'foreign_key_columns': [], 'primary_keys': ['affiliation id']}]
How many papers do we have in NAACL 2000?
SELECT count(*) FROM Paper WHERE venue = "NAACL" AND YEAR = 2000
aan_1
[{'table_name': 'paper', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'title'}, {'col_name': 'venue'}, {'col_name': 'year'}], 'foreign_key_columns': [], 'primary_keys': ['paper id']}]
Count the number of papers in NAACL 2000.
SELECT count(*) FROM Paper WHERE venue = "NAACL" AND YEAR = 2000
aan_1
[{'table_name': 'paper', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'title'}, {'col_name': 'venue'}, {'col_name': 'year'}], 'foreign_key_columns': [], 'primary_keys': ['paper id']}]
How many papers are published in year 2009 by Columbia University?
SELECT count(DISTINCT T1.paper_id) FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Affiliation AS T3 ON T2.affiliation_id = T3.affiliation_id WHERE T3.name LIKE "Columbia University" AND T1.year = 2009
aan_1
[{'table_name': 'affiliation', 'table_schema': [{'col_name': 'affiliation id'}, {'col_name': 'name'}, {'col_name': 'address'}], 'foreign_key_columns': [], 'primary_keys': ['affiliation id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id...
Count the number of papers published by Columbia University in 2009.
SELECT count(DISTINCT T1.paper_id) FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Affiliation AS T3 ON T2.affiliation_id = T3.affiliation_id WHERE T3.name LIKE "Columbia University" AND T1.year = 2009
aan_1
[{'table_name': 'affiliation', 'table_schema': [{'col_name': 'affiliation id'}, {'col_name': 'name'}, {'col_name': 'address'}], 'foreign_key_columns': [], 'primary_keys': ['affiliation id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id...
List names and addresses for all affiliations.
SELECT DISTINCT name , address FROM Affiliation
aan_1
[{'table_name': 'affiliation', 'table_schema': [{'col_name': 'affiliation id'}, {'col_name': 'name'}, {'col_name': 'address'}], 'foreign_key_columns': [], 'primary_keys': ['affiliation id']}]
What are the names and addresses for all affiliations?
SELECT DISTINCT name , address FROM Affiliation
aan_1
[{'table_name': 'affiliation', 'table_schema': [{'col_name': 'affiliation id'}, {'col_name': 'name'}, {'col_name': 'address'}], 'foreign_key_columns': [], 'primary_keys': ['affiliation id']}]
List all venues and years for papers ordered by year.
SELECT DISTINCT venue , YEAR FROM paper ORDER BY YEAR
aan_1
[{'table_name': 'paper', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'title'}, {'col_name': 'venue'}, {'col_name': 'year'}], 'foreign_key_columns': [], 'primary_keys': ['paper id']}]
What are the distinct venues for papers, ordered by year?
SELECT DISTINCT venue , YEAR FROM paper ORDER BY YEAR
aan_1
[{'table_name': 'paper', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'title'}, {'col_name': 'venue'}, {'col_name': 'year'}], 'foreign_key_columns': [], 'primary_keys': ['paper id']}]
Find the titles and paper IDs for papers written by Harvard University.
SELECT DISTINCT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Affiliation AS T3 ON T2.affiliation_id = T3.affiliation_id WHERE T3.name = "Harvard University"
aan_1
[{'table_name': 'affiliation', 'table_schema': [{'col_name': 'affiliation id'}, {'col_name': 'name'}, {'col_name': 'address'}], 'foreign_key_columns': [], 'primary_keys': ['affiliation id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id...
What are the titles and paper ids for papers written in affiliation with Harvard University?
SELECT DISTINCT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Affiliation AS T3 ON T2.affiliation_id = T3.affiliation_id WHERE T3.name = "Harvard University"
aan_1
[{'table_name': 'affiliation', 'table_schema': [{'col_name': 'affiliation id'}, {'col_name': 'name'}, {'col_name': 'address'}], 'foreign_key_columns': [], 'primary_keys': ['affiliation id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id...
Find all papers with titles and paper IDs written by Mckeown.
SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Author AS T3 ON T3.author_id = T2.author_id WHERE T3.name LIKE "%Mckeown%"
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
What are the titles and paper ids for papers written by Mckeown?
SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Author AS T3 ON T3.author_id = T2.author_id WHERE T3.name LIKE "%Mckeown%"
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
Find all papers with titles and paper IDs collaborated by Stanford University and Columbia University.
SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Affiliation AS T3 ON T2.affiliation_id = T3.affiliation_id WHERE T3.name LIKE "Stanford University" INTERSECT SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id...
aan_1
[{'table_name': 'affiliation', 'table_schema': [{'col_name': 'affiliation id'}, {'col_name': 'name'}, {'col_name': 'address'}], 'foreign_key_columns': [], 'primary_keys': ['affiliation id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id...
What are the titles and paper ids for papers which were affiliated with both Stanford and Columbia University?
SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Affiliation AS T3 ON T2.affiliation_id = T3.affiliation_id WHERE T3.name LIKE "Stanford University" INTERSECT SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id...
aan_1
[{'table_name': 'affiliation', 'table_schema': [{'col_name': 'affiliation id'}, {'col_name': 'name'}, {'col_name': 'address'}], 'foreign_key_columns': [], 'primary_keys': ['affiliation id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id...
Find all papers with titles and paper IDs co-authored by Mckeown, Kathleen and Rambow, Owen.
SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Author AS T3 ON T2.author_id = T3.author_id WHERE T3.name LIKE "%Mckeown , Kathleen%" INTERSECT SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Author ...
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
What are the titles and paper ids co-authored by Mckeown, Kathleen and Rambow, Owen?
SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Author AS T3 ON T2.author_id = T3.author_id WHERE T3.name LIKE "%Mckeown , Kathleen%" INTERSECT SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Author ...
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
Find the titles and paper IDs for papers which have Mckeown but not Rambow in author list.
SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Author AS T3 ON T2.author_id = T3.author_id WHERE T3.name LIKE "%Mckeown%" EXCEPT SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Author AS T3 ON T2.aut...
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
What are the titles and paper ids which have Mckeown as an author, but not Rambow?
SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Author AS T3 ON T2.author_id = T3.author_id WHERE T3.name LIKE "%Mckeown%" EXCEPT SELECT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Author AS T3 ON T2.aut...
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
Find the titles and paper IDs for papers which have Mckeown, Kathleen or Rambow, Owen in author list.
SELECT DISTINCT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Author AS T3 ON T2.author_id = T3.author_id WHERE T3.name LIKE "%Mckeown , Kathleen%" OR T3.name LIKE "%Rambow , Owen%"
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
What are the titles and paper ids for papers that have Mckeown, Kathleen or Rambow, Owen in their author list?
SELECT DISTINCT T1.title , T1.paper_id FROM Paper AS T1 JOIN Author_list AS T2 ON T1.paper_id = T2.paper_id JOIN Author AS T3 ON T2.author_id = T3.author_id WHERE T3.name LIKE "%Mckeown , Kathleen%" OR T3.name LIKE "%Rambow , Owen%"
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
List the names of all authors and their number of papers in descending order by number of papers.
SELECT T1.name , count(*) FROM Author AS T1 JOIN Author_list AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_id ORDER BY count(*) DESC
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
How many papers did each author publish, ordered by number of papers?
SELECT T1.name , count(*) FROM Author AS T1 JOIN Author_list AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_id ORDER BY count(*) DESC
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
List all affiliations with ascending ordered number of papers.
SELECT T1.name FROM Affiliation AS T1 JOIN Author_list AS T2 ON T1.affiliation_id = T2.affiliation_id GROUP BY T1.affiliation_id ORDER BY count(*) DESC
aan_1
[{'table_name': 'affiliation', 'table_schema': [{'col_name': 'affiliation id'}, {'col_name': 'name'}, {'col_name': 'address'}], 'foreign_key_columns': [], 'primary_keys': ['affiliation id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id...
What are the names of all affiliations, ordered by number of papers?
SELECT T1.name FROM Affiliation AS T1 JOIN Author_list AS T2 ON T1.affiliation_id = T2.affiliation_id GROUP BY T1.affiliation_id ORDER BY count(*) DESC
aan_1
[{'table_name': 'affiliation', 'table_schema': [{'col_name': 'affiliation id'}, {'col_name': 'name'}, {'col_name': 'address'}], 'foreign_key_columns': [], 'primary_keys': ['affiliation id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id...
List names of all authors who have more than 50 papers.
SELECT T1.name FROM Author AS T1 JOIN Author_list AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_id HAVING count(*) > 50
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
What are the names of all authors who have more than 50 papers?
SELECT T1.name FROM Author AS T1 JOIN Author_list AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_id HAVING count(*) > 50
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
List names of all authors who have only 1 paper.
SELECT T1.name FROM Author AS T1 JOIN Author_list AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_id HAVING count(*) = 1
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
What are the names of authors who have exactly 1 paper?
SELECT T1.name FROM Author AS T1 JOIN Author_list AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_id HAVING count(*) = 1
aan_1
[{'table_name': 'author', 'table_schema': [{'col_name': 'author id'}, {'col_name': 'name'}, {'col_name': 'email'}], 'foreign_key_columns': [], 'primary_keys': ['author id']}, {'table_name': 'author list', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'author id'}, {'col_name': 'affiliation id'}], 'foreign_key...
What is the venue and year with the most number of publications?
SELECT venue , YEAR FROM paper GROUP BY venue , YEAR ORDER BY count(*) DESC LIMIT 1
aan_1
[{'table_name': 'paper', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'title'}, {'col_name': 'venue'}, {'col_name': 'year'}], 'foreign_key_columns': [], 'primary_keys': ['paper id']}]
What was the venue and year with the most publications?
SELECT venue , YEAR FROM paper GROUP BY venue , YEAR ORDER BY count(*) DESC LIMIT 1
aan_1
[{'table_name': 'paper', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'title'}, {'col_name': 'venue'}, {'col_name': 'year'}], 'foreign_key_columns': [], 'primary_keys': ['paper id']}]
What is the venue with the least number of publications?
SELECT venue FROM paper GROUP BY venue ORDER BY count(*) LIMIT 1
aan_1
[{'table_name': 'paper', 'table_schema': [{'col_name': 'paper id'}, {'col_name': 'title'}, {'col_name': 'venue'}, {'col_name': 'year'}], 'foreign_key_columns': [], 'primary_keys': ['paper id']}]