interaction_utterance
sequencelengths
0
6
interaction_query
sequencelengths
0
6
final_utterance
stringlengths
19
224
final_query
stringlengths
22
577
db_id
stringclasses
140 values
[ "Show all artists.", "What are their names and year they joined?", "Oh please just consider those who are not from United States." ]
[ "SELECT * FROM artist", "SELECT name , year_join FROM artist", "SELECT name , year_join FROM artist WHERE country != 'United States'" ]
Show all artist names and the year joined who are not from United States.
SELECT name , year_join FROM artist WHERE country != 'United States'
theme_gallery
[ "Which artists have an age above 46?", "Which artists have an age above 46 and joined after 1990?", "How many are there?" ]
[ "SELECT * FROM artist WHERE age > 46", "SELECT * FROM artist WHERE age > 46 AND year_join > 1990", "SELECT count(*) FROM artist WHERE age > 46 AND year_join > 1990" ]
How many artists are above age 46 and joined after 1990?
SELECT count(*) FROM artist WHERE age > 46 AND year_join > 1990
theme_gallery
[ "Show all artists.", "Just show those from United States.", "What is their average age?", "Also show their minimum age." ]
[ "SELECT * FROM artist", "SELECT * FROM artist WHERE country = 'United States'", "SELECT avg(age) FROM artist WHERE country = 'United States'", "SELECT avg(age) , min(age) FROM artist WHERE country = 'United States'" ]
What is the average and minimum age of all artists from United States.
SELECT avg(age) , min(age) FROM artist WHERE country = 'United States'
theme_gallery
[ "What is the year each artist joined?", "Can you order artists by the year they joined?", "What is the name of the artist who joined latest?" ]
[ "SELECT year_join FROM artist", "SELECT * FROM artist ORDER BY year_join", "SELECT name FROM artist ORDER BY year_join DESC LIMIT 1" ]
What is the name of the artist who joined latest?
SELECT name FROM artist ORDER BY year_join DESC LIMIT 1
theme_gallery
[ "Show all info about exhibition.", "Hmm just show those that took place after year 2005.", "How many are there?" ]
[ "SELECT * FROM exhibition", "SELECT * FROM exhibition WHERE YEAR >= 2005", "SELECT count(*) FROM exhibition WHERE YEAR >= 2005" ]
How many exhibition are there in year 2005 or after?
SELECT count(*) FROM exhibition WHERE YEAR >= 2005
theme_gallery
[ "Show all info about exhibition.", "What are their themes and years?", "Which themes and years had ticket prices lower than 15?" ]
[ "SELECT * FROM exhibition", "SELECT theme , YEAR FROM exhibition", "SELECT theme , YEAR FROM exhibition WHERE ticket_price < 15" ]
Show theme and year for all exhibitions with ticket prices lower than 15.
SELECT theme , YEAR FROM exhibition WHERE ticket_price < 15
theme_gallery
[ "Show all artist names.", "Show all exhibitions.", "Count exhibitions for each artist.", "Show all artist names and the number of exhibitions for each artist." ]
[ "SELECT name from artist", "SELECT * FROM exhibition", "SELECT count(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id", "SELECT T2.name , count(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id" ]
Show all artist names and the number of exhibitions for each artist.
SELECT T2.name , count(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id
theme_gallery
[ "Count exhibitions for each artist.", "Which artist has the most exhibitions?", "Give me his or her name and country." ]
[ "SELECT count(*) FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id", "SELECT * FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id ORDER BY count(*) DESC LIMIT 1", "SELECT T2.name , T2.country FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id ORDER BY count(*) DESC LIMIT 1" ]
What is the name and country for the artist with most number of exhibitions?
SELECT T2.name , T2.country FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id GROUP BY T1.artist_id ORDER BY count(*) DESC LIMIT 1
theme_gallery
[ "Show all artist ids involved in an exhibition.", "Which artists did not have any exhibition?", "What are their names?" ]
[ "SELECT artist_id FROM exhibition", "SELECT * FROM artist WHERE artist_id NOT IN (SELECT artist_id FROM exhibition)", "SELECT name FROM artist WHERE artist_id NOT IN (SELECT artist_id FROM exhibition)" ]
Show names for artists without any exhibition.
SELECT name FROM artist WHERE artist_id NOT IN (SELECT artist_id FROM exhibition)
theme_gallery
[ "Show all exhibitions.", "What is the average ticket price?", "Which exhibitions have a ticket price higher than the average?", "What are the themes and artist names for the exhibitions with a ticket price higher than the average?" ]
[ "SELECT * FROM exhibition", "SELECT avg(ticket_price) FROM exhibition", "SELECT * FROM exhibition WHERE ticket_price > (SELECT avg(ticket_price) FROM exhibition)", "SELECT T1.theme , T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.ticket_price > (SELECT avg(ticket_price) FROM exhibition)" ]
What is the theme and artist name for the exhibition with a ticket price higher than the average?
SELECT T1.theme , T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.ticket_price > (SELECT avg(ticket_price) FROM exhibition)
theme_gallery
[ "Show all info about exhibitions.", "Which exhibitions were before year 2009?", "What are their average ticket prices?", "Can you also show their minimum, and maximum ticket prices?" ]
[ "SELECT * FROM exhibition", "SELECT * FROM exhibition WHERE YEAR < 2009", "SELECT avg(ticket_price) FROM exhibition WHERE YEAR < 2009", "SELECT avg(ticket_price) , min(ticket_price) , max(ticket_price) FROM exhibition WHERE YEAR < 2009" ]
Show the average, minimum, and maximum ticket prices for exhibitions for all years before 2009.
SELECT avg(ticket_price) , min(ticket_price) , max(ticket_price) FROM exhibition WHERE YEAR < 2009
theme_gallery
[ "What is the ticket price of each exhibition?", "Sort exhibitions in a descending order of ticket price.", "Can you show the theme and year of exhibitions?" ]
[ "SELECT ticket_price FROM exhibition", "SELECT * FROM exhibition ORDER BY ticket_price DESC", "SELECT theme , YEAR FROM exhibition ORDER BY ticket_price DESC" ]
Show theme and year for all exhibitions in a descending order of ticket price.
SELECT theme , YEAR FROM exhibition ORDER BY ticket_price DESC
theme_gallery
[ "Which exhibitions were held in year 2004?", "What were the themes for each?", "Can you also the dates, and attendances?" ]
[ "SELECT * FROM exhibition WHERE year = 2004", "SELECT theme FROM exhibition WHERE year = 2004", "SELECT T2.theme , T1.date , T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T2.year = 2004" ]
What is the theme, date, and attendance for the exhibition in year 2004?
SELECT T2.theme , T1.date , T1.attendance FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T2.year = 2004
theme_gallery
[ "Show all exhibitions in 2004.", "Show all artists.", "Show all the names of the artists who didn't have an exhibition in 2004." ]
[ "select * from exhibition where year = 2004", "SELECT name FROM artist", "SELECT name FROM artist EXCEPT SELECT T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.year = 2004" ]
Show all artist names who didn't have an exhibition in 2004.
SELECT name FROM artist EXCEPT SELECT T2.name FROM exhibition AS T1 JOIN artist AS T2 ON T1.artist_id = T2.artist_id WHERE T1.year = 2004
theme_gallery
[ "Show the theme of each exhibition.", "How about of each exhibition with an attendance below 100?", "How about of each exhibition with an attendance below 100 or above 500?" ]
[ "SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id", "SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance < 100", "SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance < 100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 500" ]
Show the theme for exhibitions with both records of an attendance below 100 and above 500.
SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance < 100 INTERSECT SELECT T2.theme FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 500
theme_gallery
[ "Which exhibition has an attendance more than 100?", "How about those with an attendance of more than 100 or a ticket price below 10?", "How many are there?" ]
[ "SELECT * FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 100", "SELECT * FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 100 OR T2.ticket_price < 10", "SELECT count(*) FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 100 OR T2.ticket_price < 10" ]
How many exhibitions have a attendance more than 100 or have a ticket price below 10?
SELECT count(*) FROM exhibition_record AS T1 JOIN exhibition AS T2 ON T1.exhibition_id = T2.exhibition_id WHERE T1.attendance > 100 OR T2.ticket_price < 10
theme_gallery
[ "How many counties are there?", "What is the average crime rate of counties?", "How about the minimum and maximum?" ]
[ "SELECT COUNT(*) FROM county_public_safety", "SELECT avg(Crime_rate) FROM county_public_safety", "SELECT min(Crime_rate) , max(Crime_rate) FROM county_public_safety" ]
What are the minimum and maximum crime rate of counties?
SELECT min(Crime_rate) , max(Crime_rate) FROM county_public_safety
county_public_safety
[ "What is the average population?", "What is the maximum population?", "What is the name of its county?" ]
[ "SELECT AVG(Population) FROM county_public_safety", "SELECT Population FROM county_public_safety ORDER BY Population DESC LIMIT 1", "SELECT Name FROM county_public_safety ORDER BY Population DESC LIMIT 1" ]
List the name of the county with the largest population.
SELECT Name FROM county_public_safety ORDER BY Population DESC LIMIT 1
county_public_safety
[ "What is the minimum white percentage of the counties?", "How about the largest 5 white percentages?", "List the names of their cities." ]
[ "SELECT White FROM city ORDER BY White ASC LIMIT 1", "SELECT White FROM city ORDER BY White DESC LIMIT 5", "SELECT Name FROM city ORDER BY White DESC LIMIT 5" ]
List the names of the city with the top 5 white percentages.
SELECT Name FROM city ORDER BY White DESC LIMIT 5
county_public_safety
[ "What is the average number of police officers of all counties?", "Which county has largest number of police officers? Show its county_ID.", "Which cities are located in this county?" ]
[ "SELECT AVG(Police_officers) FROM county_public_safety", "SELECT county_ID FROM county_public_safety ORDER BY Police_officers DESC LIMIT 1", "SELECT name FROM city WHERE county_ID = (SELECT county_ID FROM county_public_safety ORDER BY Police_officers DESC LIMIT 1)" ]
Show the name of cities in the county that has the largest number of police officers.
SELECT name FROM city WHERE county_ID = (SELECT county_ID FROM county_public_safety ORDER BY Police_officers DESC LIMIT 1)
county_public_safety
[ "What is the average population of all counties?", "How many counties have a population more than 20000?", "How many cities are located in these counties?" ]
[ "SELECT AVG(population) FROM county_public_safety", "SELECT COUNT(*) FROM county_public_safety WHERE population > 20000", "SELECT count(*) FROM city WHERE county_ID IN (SELECT county_ID FROM county_public_safety WHERE population > 20000)" ]
Show the number of cities in counties that have a population more than 20000.
SELECT count(*) FROM city WHERE county_ID IN (SELECT county_ID FROM county_public_safety WHERE population > 20000)
county_public_safety
[ "What is the laargest white percentage among all cities?", "How many cities have a white percentage of more than 90?", "What is the id of the county this city is located in?", "What is this county's crime rate?" ]
[ "SELECT max(White) FROM city", "SELECT COUNT(*) FROM city WHERE White > 90", "SELECT County_ID FROM city WHERE White > 90", "SELECT T2.Crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID WHERE T1.White > 90" ]
Show the crime rate of counties with a city having white percentage more than 90.
SELECT T2.Crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID WHERE T1.White > 90
county_public_safety
[ "How many different locations are there?", "What is the location shared by the fewest counties?", "How about the one shared by most counties?" ]
[ "SELECT COUNT(DISTINCT LOCATION) FROM county_public_safety", "SELECT LOCATION FROM county_public_safety GROUP BY LOCATION ORDER BY COUNT(*) ASC LIMIT 1", "SELECT LOCATION FROM county_public_safety GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1" ]
What is the location shared by most counties?
SELECT LOCATION FROM county_public_safety GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1
county_public_safety
[ "How many cities does each county have?", "Could you order the results by the number of cities?", "Which counties do not have any cities? List their names." ]
[ "SELECT County_ID, COUNT(*) FROM city GROUP BY County_ID", "SELECT County_ID, COUNT(*) FROM city GROUP BY County_ID ORDER BY COUNT(*) DESC", "SELECT Name FROM county_public_safety WHERE County_ID NOT IN (SELECT County_ID FROM city)" ]
List the names of counties that do not have any cities.
SELECT Name FROM county_public_safety WHERE County_ID NOT IN (SELECT County_ID FROM city)
county_public_safety
[ "How many counties with location on the east?", "How about the number of counties with location on the west?", "Please show the police forces in counties with location on the east.", "How about the police forces shared by counties with location on the east and west?" ]
[ "SELECT COUNT(*) FROM county_public_safety WHERE LOCATION = \"East\"", "SELECT COUNT(*) FROM county_public_safety WHERE LOCATION = \"West\"", "SELECT Police_force FROM county_public_safety WHERE LOCATION = \"East\"", "SELECT Police_force FROM county_public_safety WHERE LOCATION = \"East\" INTERSECT SELECT Police_force FROM county_public_safety WHERE LOCATION = \"West\"" ]
Show the police force shared by counties with location on the east and west.
SELECT Police_force FROM county_public_safety WHERE LOCATION = "East" INTERSECT SELECT Police_force FROM county_public_safety WHERE LOCATION = "West"
county_public_safety
[ "What is the id of the medicine 'Amisulpride'?", "What are the enzyme ids that interact as inhibitor with medicine 'Amisulpride'?", "What is the name of this enzyme?" ]
[ "SELECT id from medicine WHERE name = 'Amisulpride'", "SELECT T2.enzyme_id from medicine as T1 JOIN medicine_enzyme_interaction as T2 ON T1.id = T2.medicine_id WHERE T1.name = 'Amisulpride' AND T2.interaction_type = 'inhibitor'", "SELECT T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id JOIN medicine AS T3 ON T2.medicine_id = T3.id WHERE T3.name = 'Amisulpride' AND T2.interaction_type = 'inhibitor'" ]
What are the names of enzymes in the medicine named 'Amisulpride' that can serve as an 'inhibitor'?
SELECT T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id JOIN medicine AS T3 ON T2.medicine_id = T3.id WHERE T3.name = 'Amisulpride' AND T2.interaction_type = 'inhibitor'
medicine_enzyme_interaction
[ "What are the ids of medicines that interact with at least one enzyme?", "Give their names, too.", "Only show that information for medicines with at least two interactions." ]
[ "SELECT DISTINCT medicine_id from medicine_enzyme_interaction", "SELECT T1.id , T1.Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id", "SELECT T1.id , T1.Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING count(*) >= 2" ]
What are the ids and names of the medicine that can interact with two or more enzymes?
SELECT T1.id , T1.Name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING count(*) >= 2
medicine_enzyme_interaction
[ "Show the id, name, and FDA approval for medicines.", "Only ones that have some interaction with an enzyme.", "Order that by descending order of number of enzymes the medicine interacts with." ]
[ "SELECT id, name, FDA_approved from medicine", "SELECT id, name, FDA_approved from medicine WHERE id in (SELECT medicine_id from medicine_enzyme_interaction)", "SELECT T1.id , T1.Name , T1.FDA_approved FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id ORDER BY count(*) DESC" ]
What are the ids, names and FDA approval status of medicines in descending order of the number of enzymes that it can interact with.
SELECT T1.id , T1.Name , T1.FDA_approved FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id ORDER BY count(*) DESC
medicine_enzyme_interaction
[ "What are the ids of enzymes that interact with at least one enzyme?", "Give their names, too.", "Which of those can interact as an 'activator'?", "Which of those interacts as 'activator' with the most number of medicines?" ]
[ "SELECT DISTINCT enzyme_id from medicine_enzyme_interaction", "SELECT T1.id , T1.Name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id = T1.id GROUP BY T1.id", "SELECT T1.id , T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id WHERE T2.interaction_type = 'activitor' GROUP BY T1.id", "SELECT T1.id , T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id WHERE T2.interaction_type = 'activitor' GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1" ]
What is the id and name of the enzyme with most number of medicines that can interact as 'activator'?
SELECT T1.id , T1.name FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T1.id = T2.enzyme_id WHERE T2.interaction_type = 'activitor' GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1
medicine_enzyme_interaction
[ "What is the enzyme id of 'ALA synthase'?", "How about for the medicine named 'Aripiprazole'?", "Show where those two ids index into the interaction table together.", "Just give the interaction type for that entry." ]
[ "SELECT id from enzyme WHERE name = 'ALA synthase'", "SELECT id from medicine WHERE name = 'Aripiprazole'", "SELECT * FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'", "SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'" ]
What is the interaction type of the enzyme named 'ALA synthase' and the medicine named 'Aripiprazole'?
SELECT T1.interaction_type FROM medicine_enzyme_interaction AS T1 JOIN medicine AS T2 ON T1.medicine_id = T2.id JOIN enzyme AS T3 ON T1.enzyme_id = T3.id WHERE T3.name = 'ALA synthase' AND T2.name = 'Aripiprazole'
medicine_enzyme_interaction
[ "Show the interaction types in decreasing order of frequency.", "Show the counts, too.", "Only show the most frequent." ]
[ "SELECT interaction_type FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY count(*) DESC", "SELECT interaction_type , count(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY count(*) DESC", "SELECT interaction_type , count(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY count(*) DESC LIMIT 1" ]
What is the most common interaction type between enzymes and medicine? And how many are there?
SELECT interaction_type , count(*) FROM medicine_enzyme_interaction GROUP BY interaction_type ORDER BY count(*) DESC LIMIT 1
medicine_enzyme_interaction
[ "Which enzyme ids have interactions?", "Which ids do not?", "Count that." ]
[ "SELECT DISTINCT enzyme_id FROM medicine_enzyme_interaction", "SELECT id FROM enzyme WHERE id NOT IN ( SELECT enzyme_id FROM medicine_enzyme_interaction );", "SELECT count(*) FROM enzyme WHERE id NOT IN ( SELECT enzyme_id FROM medicine_enzyme_interaction );" ]
How many enzymes do not have any interactions?
SELECT count(*) FROM enzyme WHERE id NOT IN ( SELECT enzyme_id FROM medicine_enzyme_interaction );
medicine_enzyme_interaction
[ "Which medicine ids interact with at least three enzymes?", "Also give the trade name for that medicine." ]
[ "SELECT medicine_id from medicine_enzyme_interaction GROUP BY medicine_id HAVING count(*) >= 3", "SELECT T1.id , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 3" ]
What is the id and trade name of the medicines can interact with at least 3 enzymes?
SELECT T1.id , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id GROUP BY T1.id HAVING COUNT(*) >= 3
medicine_enzyme_interaction
[ "Which enzyme ids have any 'inhibitor' interaction?", "For those enzyme, give the name, location and products." ]
[ "SELECT DISTINCT enzyme_id from medicine_enzyme_interaction WHERE interaction_type = 'inhibitor'", "SELECT DISTINCT T1.name , T1.location , T1.product FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id = T1.id WHERE T2.interaction_type = 'inhibitor'" ]
What are the distinct name, location and products of the enzymes which has any 'inhibitor' interaction?
SELECT DISTINCT T1.name , T1.location , T1.product FROM enzyme AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.enzyme_id = T1.id WHERE T2.interaction_type = 'inhibitor'
medicine_enzyme_interaction
[ "Which medicine id can interact both as 'inhibitor' and as 'activitor'?", "Give the medicine name and trade name for those." ]
[ "SELECT medicine_id from medicine_enzyme_interaction WHERE interaction_type = 'inhibitor' INTERSECT SELECT medicine_id from medicine_enzyme_interaction WHERE interaction_type = 'activitor'", "SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'inhibitor' INTERSECT SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'activitor'" ]
List the medicine name and trade name which can both interact as 'inhibitor' and 'activitor' with enzymes.
SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'inhibitor' INTERSECT SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id WHERE interaction_type = 'activitor'
medicine_enzyme_interaction
[ "Which medicine ids can interact with enzyme with product 'Protoporphyrinogen IX'?", "Which ones can not?", "Give the name and trade names for those." ]
[ "SELECT medicine_id FROM medicine_enzyme_interaction AS T1 JOIN enzyme AS T2 ON T2.id = T1.enzyme_id WHERE T2.product = 'Protoporphyrinogen IX'", "SELECT id from medicine WHERE id not in (SELECT medicine_id FROM medicine_enzyme_interaction AS T1 JOIN enzyme AS T2 ON T2.id = T1.enzyme_id WHERE T2.product = 'Protoporphyrinogen IX')", "SELECT name , trade_name FROM medicine EXCEPT SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id JOIN enzyme AS T3 ON T3.id = T2.enzyme_id WHERE T3.product = 'Protoporphyrinogen IX'" ]
Show the medicine names and trade names that cannot interact with the enzyme with product 'Protoporphyrinogen IX'.
SELECT name , trade_name FROM medicine EXCEPT SELECT T1.name , T1.trade_name FROM medicine AS T1 JOIN medicine_enzyme_interaction AS T2 ON T2.medicine_id = T1.id JOIN enzyme AS T3 ON T3.id = T2.enzyme_id WHERE T3.product = 'Protoporphyrinogen IX'
medicine_enzyme_interaction
[ "Tell me the films which Nick participated in.", "How many are there?", "And what is the most popular first name of the actors?" ]
[ "SELECT T2.title FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T3.first_name = \"NICK\"", "SELECT COUNT(T2.title) FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T3.first_name = \"NICK\"", "SELECT first_name FROM actor GROUP BY first_name ORDER BY count(*) DESC LIMIT 1" ]
What is the most popular first name of the actors?
SELECT first_name FROM actor GROUP BY first_name ORDER BY count(*) DESC LIMIT 1
sakila_1
[ "Tell the last name of the actor with first name ED.", "How about that of the actor with first name GRACE?", "tell me the most popular full name of the actors." ]
[ "SELECT last_name FROM actor WHERE first_name = \"ED\"", "SELECT last_name FROM actor WHERE first_name = \"GRACE\"", "SELECT first_name , last_name FROM actor GROUP BY first_name , last_name ORDER BY count(*) DESC LIMIT 1" ]
What is the most popular full name of the actors?
SELECT first_name , last_name FROM actor GROUP BY first_name , last_name ORDER BY count(*) DESC LIMIT 1
sakila_1
[ "Tell me the city of address \"47 MySakila Drive\".", "What is the district of this address?", "Which districts have at least two addresses?" ]
[ "SELECT T2.city FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.address = \"47 MySakila Drive\"", "SELECT district FROM address WHERE address = \"47 MySakila Drive\"", "SELECT district FROM address GROUP BY district HAVING count(*) >= 2" ]
Which districts have at least two addresses?
SELECT district FROM address GROUP BY district HAVING count(*) >= 2
sakila_1
[ "What is the district of \"1913 Hanoi Way?\"", "Tell me the city of this address.", "Which city has the most addresses? List the city name, number of addresses, and city id" ]
[ "SELECT district FROM address WHERE address = \"1913 Hanoi Way\"", "SELECT T2.city FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.address = \"1913 Hanoi Way\"", "SELECT T2.city , count(*) , T1.city_id FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id GROUP BY T1.city_id ORDER BY count(*) DESC LIMIT 1" ]
Which city has the most addresses? List the city name, number of addresses, and city id.
SELECT T2.city , count(*) , T1.city_id FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id GROUP BY T1.city_id ORDER BY count(*) DESC LIMIT 1
sakila_1
[ "Tell me the actors' first name in the film \"ACE GOLDFINGER\".", "What is the rental fee of this film?", "Which film is rented at a fee of 0.99 and has less than 3 in the inventory? List the film title and id." ]
[ "SELECT T3.first_name FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T2.title = \"ACE GOLDFINGER\"", "SELECT rental_rate FROM film WHERE title = \"ACE GOLDFINGER\"", "SELECT title , film_id FROM film WHERE rental_rate = 0.99 INTERSECT SELECT T1.title , T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id HAVING count(*) < 3" ]
Which film is rented at a fee of 0.99 and has less than 3 in the inventory? List the film title and id.
SELECT title , film_id FROM film WHERE rental_rate = 0.99 INTERSECT SELECT T1.title , T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id HAVING count(*) < 3
sakila_1
[ "Tell me the city of address \"1913 Hanoi Way\".", "What is the country of this address?", "And how many cities are there in Australia?" ]
[ "SELECT T2.city FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T1.address = \"1913 Hanoi Way\"", "SELECT T3.country FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id JOIN country AS T3 ON T2.country_id = T3.country_id WHERE T1.address = \"1913 Hanoi Way\"", "SELECT count(*) FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id WHERE T2.country = 'Australia'" ]
How many cities are there in Australia?
SELECT count(*) FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id WHERE T2.country = 'Australia'
sakila_1
[ "Tell me the phones in the city \"Acua\".", "How about that of the the city \"Bag\"?", "Which countries have at least 3 cities?" ]
[ "SELECT T1.phone FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.city = \"Acua\"", "SELECT T1.phone FROM address AS T1 JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.city = \"Bag\"", "SELECT T2.country FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id GROUP BY T2.country_id HAVING count(*) >= 3" ]
Which countries have at least 3 cities?
SELECT T2.country FROM city AS T1 JOIN country AS T2 ON T1.country_id = T2.country_id GROUP BY T2.country_id HAVING count(*) >= 3
sakila_1
[ "Tell me the payment amount for the payment id 4.", "How about its date?", "Tell me all the payment dates for the payments with an amount larger than 10 and the payments handled by a staff person with the first name Elsa." ]
[ "SELECT amount FROM payment WHERE payment_id = 4", "SELECT payment_date FROM payment WHERE payment_id = 4", "SELECT payment_date FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa'" ]
Find all the payment dates for the payments with an amount larger than 10 and the payments handled by a staff person with the first name Elsa.
SELECT payment_date FROM payment WHERE amount > 10 UNION SELECT T1.payment_date FROM payment AS T1 JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Elsa'
sakila_1
[ "Tell me the category of the film \"ADAPTATION HOLES\".", "How about the rental rate of this film?", "tell me which film has the highest rental rate? What is that rate?" ]
[ "SELECT T2.title FROM film_category AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN category AS T3 on T1.category_id = T3.category_id WHERE T2.title = \"ADAPTATION HOLES\"", "SELECT rental_rate FROM film WHERE title = \"ADAPTATION HOLES\"", "SELECT title , rental_rate FROM film ORDER BY rental_rate DESC LIMIT 1" ]
Which film has the highest rental rate? And what is the rate?
SELECT title , rental_rate FROM film ORDER BY rental_rate DESC LIMIT 1
sakila_1
[ "Tell me the films which BETTE participated in.", "How about the films which JOE starred in?", "Which film has the most number of actors or actresses? List the film name, film id and description." ]
[ "SELECT T2.title FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T3.first_name = \"BETTE\"", "SELECT T2.title FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T3.first_name = \"JOE\"", "SELECT T2.title , T2.film_id , T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.film_id ORDER BY count(*) DESC LIMIT 1" ]
Which film has the most number of actors or actresses? List the film name, film id and description.
SELECT T2.title , T2.film_id , T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T2.film_id ORDER BY count(*) DESC LIMIT 1
sakila_1
[ "Tell me the description of the film titled \"AIRPORT POLLOCK\".", "Who are the actors in this film? Give the first and last name.", "And which film actor (actress) starred in the most films? List his or her first name, last name and actor id." ]
[ "SELECT description FROM film WHERE title = \"AIRPORT POLLOCK\"", "SELECT T3.first_name, T3.last_name FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T2.title = \"ACE GOLDFINGER\"", "SELECT T2.first_name , T2.last_name , T2.actor_id FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id ORDER BY count(*) DESC LIMIT 1" ]
Which film actor (actress) starred the most films? List his or her first name, last name and actor id.
SELECT T2.first_name , T2.last_name , T2.actor_id FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id ORDER BY count(*) DESC LIMIT 1
sakila_1
[ "Tell me the release year of the film titled \"ALI FOREVER\".", "tell me the last name of the actors in it.", "Tell me which film actors (actresses) played a role in more than 30 films? List his or her first name and last name." ]
[ "SELECT release_year FROM film WHERE title = \"ALI FOREVER\"", "SELECT T3.first_name, T3.last_name FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T2.title = \"ALI FOREVER\"", "SELECT T2.first_name , T2.last_name FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id HAVING count(*) > 30" ]
Which film actors (actresses) played a role in more than 30 films? List his or her first name and last name.
SELECT T2.first_name , T2.last_name FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.actor_id HAVING count(*) > 30
sakila_1
[ "Tell me the number of items in the inventory for the film titled \"ALI FOREVER\".", "Which film has the most items?", "Which store owns most items?" ]
[ "SELECT COUNT(*) FROM inventory AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id WHERE T2.title = \"ALI FOREVER\"", "SELECT title FROM inventory AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id ORDER BY count(*) DESC LIMIT 1", "SELECT store_id FROM inventory GROUP BY store_id ORDER BY count(*) DESC LIMIT 1" ]
Which store owns most items?
SELECT store_id FROM inventory GROUP BY store_id ORDER BY count(*) DESC LIMIT 1
sakila_1
[ "Tell me the email of customer with first name PATRICIA.", "Tell me all the information about the payments they made.", "tell me which customer, who has made at least one payment, has spent the least money. List his or her first name, last name, and the id." ]
[ "SELECT email FROM customer WHERE first_name = \"PATRICIA\"", "SELECT * FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id WHERE T1.first_name = \"PATRICIA\"", "SELECT T1.first_name , T1.last_name , T1.customer_id FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY sum(amount) ASC LIMIT 1" ]
Which customer, who has made at least one payment, has spent the least money? List his or her first name, last name, and the id.
SELECT T1.first_name , T1.last_name , T1.customer_id FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY sum(amount) ASC LIMIT 1
sakila_1
[ "What are the actors in the film titled ALONE TRIP?", "How about that of the film titled HUNGER ROOF?", "What's the genre name of this film?" ]
[ "SELECT T3.first_name, T3.last_name FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T2.title = \"ALONE TRIP\"", "SELECT T3.first_name, T3.last_name FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T2.title = \"HUNGER ROOF\"", "SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id = T2.category_id JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'HUNGER ROOF'" ]
What is the genre name of the film HUNGER ROOF?
SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id = T2.category_id JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'HUNGER ROOF'
sakila_1
[ "Tell me about the special features of the film titled ACADEMY DINOSAUR.", "What is its category?", "How many films are there in each category?" ]
[ "SELECT special_features FROM film WHERE title = \"ACADEMY DINOSAUR\"", "SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id = T2.category_id JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'ACADEMY DINOSAUR'", "SELECT T2.name , T1.category_id , count(*) FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T1.category_id" ]
How many films are there in each category? List the genre name, genre id and the count.
SELECT T2.name , T1.category_id , count(*) FROM film_category AS T1 JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T1.category_id
sakila_1
[ "Tell me the rating of the film titled AGENT TRUMAN.", "Tell me the number of its copies in the inventory.", "And which film has the most copies in the inventory? Tell me both title and id." ]
[ "SELECT rating FROM film WHERE title = \"AGENT TRUMAN\"", "SELECT COUNT(*) FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.title = \"AGENT TRUMAN\"", "SELECT T1.title , T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id ORDER BY count(*) DESC LIMIT 1" ]
Which film has the most copies in the inventory? List both title and id.
SELECT T1.title , T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id GROUP BY T1.film_id ORDER BY count(*) DESC LIMIT 1
sakila_1
[ "What is the rental rate of film titled ALAMO VIDEOTAPE?", "How about the number of times it was rented.", "What is the film title and inventory id of the item in the inventory which was rented most frequently?" ]
[ "SELECT rental_rate FROM film WHERE title = \"ALAMO VIDEOTAPE\"", "SELECT COUNT(*) FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T2.inventory_id WHERE T1.title = \"ALAMO VIDEOTAPE\"", "SELECT T1.title , T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T2.inventory_id ORDER BY count(*) DESC LIMIT 1" ]
What is the film title and inventory id of the item in the inventory which was rented most frequently?
SELECT T1.title , T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id = T2.film_id JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T2.inventory_id ORDER BY count(*) DESC LIMIT 1
sakila_1
[ "Tell me the number of items in store 2.", "Tell me that of store 1.", "And where is store 1 located?" ]
[ "SELECT COUNT(*) FROM inventory WHERE store_id = 2", "SELECT COUNT(*) FROM inventory WHERE store_id = 1", "SELECT T2.address FROM store AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE store_id = 1" ]
Where is store 1 located?
SELECT T2.address FROM store AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE store_id = 1
sakila_1
[ "Tell me the date of payment with id 3.", "How about its staff name? Give the first name and last name.", "tell me which staff handled the least number of payments? List the full name and the id." ]
[ "SELECT payment_date FROM payment WHERE payment_id = 3", "SELECT T1.first_name , T1.last_name FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id = T2.staff_id WHERE T2.payment_id = 3", "SELECT T1.first_name , T1.last_name , T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id = T2.staff_id GROUP BY T1.staff_id ORDER BY count(*) ASC LIMIT 1" ]
Which staff handled least number of payments? List the full name and the id.
SELECT T1.first_name , T1.last_name , T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id = T2.staff_id GROUP BY T1.staff_id ORDER BY count(*) ASC LIMIT 1
sakila_1
[ "What is the length of the film titled AIRPORT POLLOCK?", "How about its rental duration?", "And which language does the film AIRPORT POLLOCK use? List the language name." ]
[ "SELECT length FROM film WHERE title = 'AIRPORT POLLOCK'", "SELECT rental_duration FROM film WHERE title = 'AIRPORT POLLOCK'", "SELECT T2.name FROM film AS T1 JOIN LANGUAGE AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'AIRPORT POLLOCK'" ]
Which language does the film AIRPORT POLLOCK use? List the language name.
SELECT T2.name FROM film AS T1 JOIN LANGUAGE AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'AIRPORT POLLOCK'
sakila_1
[ "Tell me the movies in which the actor named ZERO played a role in.", "What are the special features of this film?", "Which movies have 'Deleted Scenes' as a substring in the special feature?" ]
[ "SELECT T2.title FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T3.first_name = \"ZERO\"", "SELECT T2.special_features FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id = T2.film_id JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T3.first_name = \"ZERO\"", "SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%'" ]
Which movies have 'Deleted Scenes' as a substring in the special feature?
SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%'
sakila_1
[ "What are the payments of the customer named LINDA?", "What are the dates of these payments?", "And when did the first payment happen?" ]
[ "SELECT * FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id WHERE T1.first_name = \"LINDA\"", "SELECT T2.payment_date FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id WHERE T1.first_name = \"LINDA\"", "SELECT payment_date FROM payment ORDER BY payment_date ASC LIMIT 1" ]
When did the first payment happen?
SELECT payment_date FROM payment ORDER BY payment_date ASC LIMIT 1
sakila_1
[ "How many payments did LINDA make?", "Tell me all the information about the largest one.", "tell me where she lives, and also her email." ]
[ "SELECT COUNT(*) FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id WHERE T1.first_name = \"LINDA\"", "SELECT * FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id WHERE T1.first_name = \"LINDA\" ORDER BY T2.amount DESC LIMIT 1", "SELECT T2.address , T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id = T1.address_id WHERE T1.first_name = 'LINDA'" ]
Where does the customer with the first name Linda live? And what is her email?
SELECT T2.address , T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id = T1.address_id WHERE T1.first_name = 'LINDA'
sakila_1
[ "Tell me the release year of the film titleed ACE GOLDFINGER.", "What is the rating of this film?", "tell me all the films longer than 100 minutes, or rated PG, except those who cost more than 200 for replacement." ]
[ "SELECT release_year FROM film WHERE title = \"ACE GOLDFINGER\"", "SELECT rating FROM film WHERE title = \"ACE GOLDFINGER\"", "SELECT title FROM film WHERE LENGTH > 100 OR rating = 'PG' EXCEPT SELECT title FROM film WHERE replacement_cost > 200" ]
Find all the films longer than 100 minutes, or rated PG, except those who cost more than 200 for replacement. List the titles.
SELECT title FROM film WHERE LENGTH > 100 OR rating = 'PG' EXCEPT SELECT title FROM film WHERE replacement_cost > 200
sakila_1
[ "Tell me the email of the customer named MARIA.", "Tell me all the information about her rentals.", "What is the first name and the last name of the customer who made the earliest rental?" ]
[ "SELECT email FROM customer WHERE first_name = \"MARIA\"", "SELECT * FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = \"MARIA\"", "SELECT T1.first_name , T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.rental_date ASC LIMIT 1" ]
What is the first name and the last name of the customer who made the earliest rental?
SELECT T1.first_name , T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id ORDER BY T2.rental_date ASC LIMIT 1
sakila_1
[ "Tell me the customer of rental with id 2.", "How about its return date?", "What is the full name of the staff member who has rented a film to a customer with the first name April and the last name Burns?" ]
[ "SELECT T1.first_name, T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T2.rental_id = 2", "SELECT return_date FROM rental WHERE rental_id = 2", "SELECT DISTINCT T1.first_name , T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id = T2.staff_id JOIN customer AS T3 ON T2.customer_id = T3.customer_id WHERE T3.first_name = 'APRIL' AND T3.last_name = 'BURNS'" ]
What is the full name of the staff member who has rented a film to a customer with the first name April and the last name Burns?
SELECT DISTINCT T1.first_name , T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id = T2.staff_id JOIN customer AS T3 ON T2.customer_id = T3.customer_id WHERE T3.first_name = 'APRIL' AND T3.last_name = 'BURNS'
sakila_1
[ "Tell me all the information about the stores.", "Tell me how many items are in store 3.", "Which store has the most customers?" ]
[ "SELECT * FROM store", "SELECT COUNT(*) FROM inventory WHERE store_id = 3", "SELECT store_id FROM customer GROUP BY store_id ORDER BY count(*) DESC LIMIT 1" ]
Which store has most the customers?
SELECT store_id FROM customer GROUP BY store_id ORDER BY count(*) DESC LIMIT 1
sakila_1
[ "Tell me all the information about Lisa's payments.", "What's the largest one among those? Give the payment amount.", "What's the largest one among all the payments?" ]
[ "SELECT * FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id WHERE T1.first_name = \"Lisa\"", "SELECT T2.amount FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id WHERE T1.first_name = \"Lisa\" ORDER BY T2.amount DESC LIMIT 1", "SELECT amount FROM payment ORDER BY amount DESC LIMIT 1" ]
What is the largest payment amount?
SELECT amount FROM payment ORDER BY amount DESC LIMIT 1
sakila_1
[ "Tell me the store in which the staff member with first name \"Elsa\" works.", "Tell me her email.", "Where does she live?" ]
[ "SELECT * FROM staff AS T1 JOIN store AS T2 ON T1.store_id = T2.store_id WHERE T1.first_name = 'Elsa'", "SELECT email FROM staff WHERE first_name = 'Elsa'", "SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa'" ]
Where does the staff member with the first name Elsa live?
SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Elsa'
sakila_1
[ "Show the id for all accounts.", "Also show the date the account opened and the account name.", "Also show account details." ]
[ "SELECT account_id FROM Accounts", "SELECT account_id , date_account_opened , account_name FROM Accounts", "SELECT account_id , date_account_opened , account_name , other_account_details FROM Accounts" ]
Show the id, the date of account opened, the account name, and other account detail for all accounts.
SELECT account_id , date_account_opened , account_name , other_account_details FROM Accounts
customers_and_invoices
[ "Show the account id for all accounts.", "Also show the customer first name for these accounts.", "What are the ids for the accounts owned by the customer with first name 'Meaghan'?", "Also show the account name, and other account details for these accounts." ]
[ "SELECT account_id FROM Accounts", "SELECT T1.account_id, T2.customer_first_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id", "SELECT T1.account_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan'", "SELECT T1.account_id , T1.date_account_opened , T1.account_name , T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan'" ]
Show the id, the account name, and other account details for all accounts by the customer with first name 'Meaghan'.
SELECT T1.account_id , T1.date_account_opened , T1.account_name , T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = 'Meaghan'
customers_and_invoices
[ "Show the account name and other account details for all accounts.", "How about those accounts by the customer with first name Meaghan and last name Keeling?" ]
[ "SELECT account_name , other_account_details FROM Accounts", "SELECT T1.account_name , T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = \"Meaghan\" AND T2.customer_last_name = \"Keeling\"" ]
Show the account name and other account detail for all accounts by the customer with first name Meaghan and last name Keeling.
SELECT T1.account_name , T1.other_account_details FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.customer_first_name = "Meaghan" AND T2.customer_last_name = "Keeling"
customers_and_invoices
[ "Show the first name and last name for all customers.", "Also show their account names.", "Who has the account with name 900?" ]
[ "SELECT customer_first_name , customer_last_name FROM Customers", "SELECT T2.customer_first_name , T2.customer_last_name, T1.account_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id", "SELECT T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = \"900\"" ]
Show the first name and last name for the customer with account name 900.
SELECT T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T1.account_name = "900"
customers_and_invoices
[ "Show the first name, last name, and phone number for all customers.", "How about those with an account?", "Show their distinct information." ]
[ "SELECT customer_first_name , customer_last_name , phone_number FROM Customers", "SELECT T1.customer_first_name , T1.customer_last_name , T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id", "SELECT DISTINCT T1.customer_first_name , T1.customer_last_name , T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id" ]
Show the unique first names, last names, and phone numbers for all customers with any account.
SELECT DISTINCT T1.customer_first_name , T1.customer_last_name , T1.phone_number FROM Customers AS T1 JOIN Accounts AS T2 ON T1.customer_id = T2.customer_id
customers_and_invoices
[ "Show customer ids for all customers.", "Show ids for those who have an account.", "How about those who don't?" ]
[ "SELECT customer_id FROM Customers", "SELECT customer_id FROM Accounts", "SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts" ]
Show customer ids who don't have an account.
SELECT customer_id FROM Customers EXCEPT SELECT customer_id FROM Accounts
customers_and_invoices
[ "Show the id for all customers with an account.", "How many accounts do each of them have?" ]
[ "SELECT customer_id FROM Accounts", "SELECT count(*) , customer_id FROM Accounts GROUP BY customer_id" ]
How many accounts does each customer have? List the number and customer id.
SELECT count(*) , customer_id FROM Accounts GROUP BY customer_id
customers_and_invoices
[ "Show the customer id for all customers with an account.", "Also show their first and last name.", "Order them by the number of accounts in descending order.", "Who has the most?" ]
[ "SELECT customer_id FROM Accounts", "SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id", "SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC", "SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1" ]
What is the customer id, first and last name with most number of accounts.
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
customers_and_invoices
[ "Show the first name and last name for all customers.", "Also show the number of accounts owned by each of them.", "Also show their customer ids." ]
[ "SELECT customer_first_name , customer_last_name from Customers", "SELECT T2.customer_first_name , T2.customer_last_name , count(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id", "SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name , count(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id" ]
Show id, first name and last name for all customers and the number of accounts.
SELECT T1.customer_id , T2.customer_first_name , T2.customer_last_name , count(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id
customers_and_invoices
[ "Show the first name and id for all customers with an accout.", "For each of them, also count the number of accounts.", "Show the first name and id for those with at least 2 accounts." ]
[ "SELECT T2.customer_first_name , T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id", "SELECT T2.customer_first_name , T1.customer_id , count(*) FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id", "SELECT T2.customer_first_name , T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2" ]
Show first name and id for all customers with at least 2 accounts.
SELECT T2.customer_first_name , T1.customer_id FROM Accounts AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) >= 2
customers_and_invoices
[ "Show the total number of customers.", "Break down this number by gender." ]
[ "SELECT count(*) FROM Customers", "SELECT gender , count(*) FROM Customers GROUP BY gender" ]
Show the number of customers for each gender.
SELECT gender , count(*) FROM Customers GROUP BY gender
customers_and_invoices
[ "Show the information for all financial transactions.", "How many are there?" ]
[ "SELECT * FROM Financial_transactions", "SELECT count(*) FROM Financial_transactions" ]
How many transactions do we have?
SELECT count(*) FROM Financial_transactions
customers_and_invoices
[ "Show the id of accounts with a financial transaction.", "For each of them, count the number of financial transactions." ]
[ "SELECT account_id FROM Financial_transactions", "SELECT count(*) , account_id FROM Financial_transactions GROUP BY account_id" ]
How many transaction does each account have? Show the number and account id.
SELECT count(*) , account_id FROM Financial_transactions
customers_and_invoices
[ "Show the transaction id for each financial transaction.", "Also show the account name for each of them.", "Limit the results to transactions from accounts with the account name 337.", "How many of those are there?" ]
[ "select transaction_id FROM Financial_transactions", "SELECT T1.transaction_id , T2.account_name FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id", "SELECT T1.transaction_id , T2.account_name FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = \"337\"", "SELECT count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = \"337\"" ]
How many transaction does account with name 337 have?
SELECT count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id WHERE T2.account_name = "337"
customers_and_invoices
[ "Show the transaction amount for each transaction.", "What is the average?", "Also show the minimum, maximum, and total." ]
[ "SELECT transaction_amount FROM Financial_transactions", "SELECT avg(transaction_amount) FROM Financial_transactions", "SELECT avg(transaction_amount) , min(transaction_amount) , max(transaction_amount) , sum(transaction_amount) FROM Financial_transactions" ]
What is the average, minimum, maximum, and total transaction amount?
SELECT avg(transaction_amount) , min(transaction_amount) , max(transaction_amount) , sum(transaction_amount) FROM Financial_transactions
customers_and_invoices
[ "Show ids for all transactions.", "What is the average transaction amount?", "What are the ids of transactions whose amount is greater than it?" ]
[ "SELECT transaction_id FROM Financial_transactions", "SELECT avg(transaction_amount) FROM Financial_transactions", "SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT avg(transaction_amount) FROM Financial_transactions)" ]
Show ids for all transactions whose amounts are greater than the average.
SELECT transaction_id FROM Financial_transactions WHERE transaction_amount > (SELECT avg(transaction_amount) FROM Financial_transactions)
customers_and_invoices
[ "Show the transaction type for each transaction.", "For each type, what is the total amount of transactions?" ]
[ "SELECT transaction_type FROM Financial_transactions", "SELECT transaction_type , sum(transaction_amount) FROM Financial_transactions GROUP BY transaction_type" ]
Show the transaction types and the total amount of transactions.
SELECT transaction_type , sum(transaction_amount) FROM Financial_transactions GROUP BY transaction_type
customers_and_invoices
[ "Show the account id for each transaction.", "Also show the account name for each.", "For each account, show the number of transactions." ]
[ "SELECT account_id FROM Financial_transactions", "SELECT T2.account_name , T1.account_id FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id", "SELECT T2.account_name , T1.account_id , count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id" ]
Show the account name, id and the number of transactions for each account.
SELECT T2.account_name , T1.account_id , count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id
customers_and_invoices
[ "Show the account id for each transaction.", "For each of them, show the number of transactions.", "Order the ids in descending order of the number of transactions.", "Which id has the most?" ]
[ "SELECT account_id FROM Financial_transactions", "SELECT account_id, count(*) FROM Financial_transactions GROUP BY account_id", "SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY count(*) DESC", "SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY count(*) DESC LIMIT 1" ]
Show the account id with most number of transactions.
SELECT account_id FROM Financial_transactions GROUP BY account_id ORDER BY count(*) DESC LIMIT 1
customers_and_invoices
[ "Show the account id and name for each account with a transaction.", "Also count the number of transactions for each of them.", "Which of them have at least 4 transactions?" ]
[ "SELECT T1.account_id , T2.account_name FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id", "SELECT T1.account_id , T2.account_name , count(*) FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id", "SELECT T1.account_id , T2.account_name FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id HAVING count(*) >= 4" ]
Show the account id and name with at least 4 transactions.
SELECT T1.account_id , T2.account_name FROM Financial_transactions AS T1 JOIN Accounts AS T2 ON T1.account_id = T2.account_id GROUP BY T1.account_id HAVING count(*) >= 4
customers_and_invoices
[ "Show information for all products.", "What are their sizes?", "Only show distinct sizes." ]
[ "SELECT * FROM Products", "SELECT product_size FROM Products", "SELECT DISTINCT product_size FROM Products" ]
Show all product sizes.
SELECT DISTINCT product_size FROM Products
customers_and_invoices
[ "Show info for all products.", "Show their distinct colors." ]
[ "SELECT * FROM Products", "SELECT DISTINCT product_color FROM Products" ]
Show all product colors.
SELECT DISTINCT product_color FROM Products
customers_and_invoices
[ "Show the invoice number for each transaction.", "For each of them, show the number of transactions." ]
[ "SELECT invoice_number FROM Financial_transactions", "SELECT invoice_number , count(*) FROM Financial_transactions GROUP BY invoice_number" ]
Show the invoice number and the number of transactions for each invoice.
SELECT invoice_number , count(*) FROM Financial_transactions GROUP BY invoice_number
customers_and_invoices
[ "Show the invoice number of each transaction.", "Also show the invoice date.", "Also show the number of transactions for each of them.", "Which one has the most transactions?" ]
[ "SELECT invoice_number from Financial_transactions", "SELECT T2.invoice_number , T2.invoice_date FROM Financial_transactions AS T1 JOIN Invoices AS T2 ON T1.invoice_number = T2.invoice_number", "SELECT T2.invoice_number , T2.invoice_date, count(*) FROM Financial_transactions AS T1 JOIN Invoices AS T2 ON T1.invoice_number = T2.invoice_number GROUP BY T1.invoice_number", "SELECT T2.invoice_number , T2.invoice_date FROM Financial_transactions AS T1 JOIN Invoices AS T2 ON T1.invoice_number = T2.invoice_number GROUP BY T1.invoice_number ORDER BY count(*) DESC LIMIT 1" ]
What is the invoice number and invoice date for the invoice with most number of transactions?
SELECT T2.invoice_number , T2.invoice_date FROM Financial_transactions AS T1 JOIN Invoices AS T2 ON T1.invoice_number = T2.invoice_number GROUP BY T1.invoice_number ORDER BY count(*) DESC LIMIT 1
customers_and_invoices
[ "Show the information for all invoices.", "How many are there?" ]
[ "SELECT * FROM Invoices", "SELECT count(*) FROM Invoices" ]
How many invoices do we have?
SELECT count(*) FROM Invoices
customers_and_invoices
[ "Show the invoice date for all invoices.", "Also show their order ids.", "Also show their order details." ]
[ "SELECT invoice_date from Invoices", "SELECT invoice_date , order_id FROM Invoices", "SELECT T1.invoice_date , T1.order_id , T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id" ]
Show invoice dates and order id and details for all invoices.
SELECT T1.invoice_date , T1.order_id , T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id
customers_and_invoices
[ "Show the order id for each invoice.", "What is the number of invoices for each order?" ]
[ "SELECT order_id FROM Invoices", "SELECT order_id , count(*) FROM Invoices GROUP BY order_id" ]
Show the order ids and the number of invoices for each order.
SELECT order_id , count(*) FROM Invoices GROUP BY order_id
customers_and_invoices
[ "Show the order id and order details for all orders.", "For each of them, count the number of invoices as well.", "Which of them have more than two?" ]
[ "SELECT order_id , order_details FROM Orders", "SELECT T2.order_id , T2.order_details, count(*) FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id GROUP BY T2.order_id", "SELECT T2.order_id , T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id GROUP BY T2.order_id HAVING count(*) > 2" ]
What is the order id and order details for the order more than two invoices.
SELECT T2.order_id , T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id = T2.order_id GROUP BY T2.order_id HAVING count(*) > 2
customers_and_invoices
[ "Show the last name, id, and phone number for all customers.", "For each of them, show the number of orders as well.", "Sort them in descending order of the number of orders.", "Who has the most?" ]
[ "SELECT customer_last_name , customer_id , phone_number FROM Customers", "SELECT T2.customer_last_name , T1.customer_id , T2.phone_number , count(*) FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id", "SELECT T2.customer_last_name , T1.customer_id , T2.phone_number FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC", "SELECT T2.customer_last_name , T1.customer_id , T2.phone_number FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1" ]
What is the customer last name, id and phone number with most number of orders?
SELECT T2.customer_last_name , T1.customer_id , T2.phone_number FROM Orders AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
customers_and_invoices
[ "Show all product names", "Which of them has an order?", "Which of them don't?" ]
[ "SELECT product_name FROM Products", "SELECT T1.product_name FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id", "SELECT product_name FROM Products EXCEPT SELECT T1.product_name FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id" ]
Show all product names without an order.
SELECT product_name FROM Products EXCEPT SELECT T1.product_name FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id
customers_and_invoices
[ "Show all product names", "Also show the quantity ordered for each order of a product.", "What is the total quantity ordered for each product name?" ]
[ "SELECT product_name FROM Products", "SELECT T2.product_name , T1.product_quantity FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id", "SELECT T2.product_name , sum(T1.product_quantity) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name" ]
Show all product names and the total quantity ordered for each product name.
SELECT T2.product_name , sum(T1.product_quantity) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id GROUP BY T2.product_name
customers_and_invoices
[ "Show the order id for each order item.", "For each of those ids, how many items were ordered?" ]
[ "SELECT order_id FROM Order_items", "SELECT order_id , count(*) FROM Order_items GROUP BY order_id" ]
Show the order ids and the number of items in each order.
SELECT order_id , count(*) FROM Order_items GROUP BY order_id
customers_and_invoices
[ "Show the product id for all orders.", "Also show the order id.", "For each of those product ids, what is the number of unique orders containing each product?" ]
[ "SELECT product_id FROM Order_items", "SELECT product_id, order_id FROM Order_items", "SELECT product_id , count(DISTINCT order_id) FROM Order_items GROUP BY product_id" ]
Show the product ids and the number of unique orders containing each product.
SELECT product_id , count(DISTINCT order_id) FROM Order_items GROUP BY product_id
customers_and_invoices
[ "Show all product names.", "For each of them, what is the number of order items on each?" ]
[ "SELECT product_name FROM Products", "SELECT T2.product_name , count(*) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T3.order_id = T1.order_id GROUP BY T2.product_name" ]
Show all product names and the number of order items on each product.
SELECT T2.product_name , count(*) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T3.order_id = T1.order_id GROUP BY T2.product_name
customers_and_invoices