db_id
stringclasses
40 values
query
stringlengths
22
608
question
stringlengths
22
185
book_review
SELECT T1.Title , T2.Rating FROM book AS T1 JOIN review AS T2 ON T1.Book_ID = T2.Book_ID
What are the titles and ratings of books?
book_review
SELECT T2.Rating FROM book AS T1 JOIN review AS T2 ON T1.Book_ID = T2.Book_ID ORDER BY T1.Chapters DESC LIMIT 1
What is the rating of the book with the largest number of chapters?
book_review
SELECT T2.Rank FROM book AS T1 JOIN review AS T2 ON T1.Book_ID = T2.Book_ID ORDER BY T1.Pages ASC LIMIT 1
What is the rank of the book with the smallest number of pages?
book_review
SELECT T1.Title FROM book AS T1 JOIN review AS T2 ON T1.Book_ID = T2.Book_ID ORDER BY T2.Rank LIMIT 1
What is the title of the book with the highest rank in the review?
book_review
SELECT avg(T2.Readers_in_Million) FROM book AS T1 JOIN review AS T2 ON T1.Book_ID = T2.Book_ID WHERE T1.Type = "Novel"
What is the average number of readers for books of type "Novel"?
book_review
SELECT TYPE , COUNT(*) FROM book GROUP BY TYPE
For each book type return the type and the number of books of that type.
book_review
SELECT TYPE FROM book GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
What is the most common type of books?
book_review
SELECT TYPE FROM book GROUP BY TYPE HAVING COUNT(*) >= 3
What are the types of books that have at least three books belonging to?
book_review
SELECT T1.Title FROM book AS T1 JOIN review AS T2 ON T1.Book_ID = T2.Book_ID ORDER BY T2.Rating ASC
List the titles of books in ascending order of the ratings in review?
book_review
SELECT T1.Title , T1.audio FROM book AS T1 JOIN review AS T2 ON T1.Book_ID = T2.Book_ID ORDER BY T2.Readers_in_Million DESC
List the title and audio length for all the books in descending order of the number of readers.
book_review
SELECT count(*) FROM book WHERE Book_ID NOT IN (SELECT Book_ID FROM review)
How many books do not have reviews?
book_review
SELECT TYPE FROM book WHERE Chapters > 75 INTERSECT SELECT TYPE FROM book WHERE Chapters < 50
Show the types of books that have both books with more than 75 chapters and books with less than 50 chapters.
book_review
SELECT count(DISTINCT TYPE) FROM book
How many distinct types of book are there?
book_review
SELECT TYPE , title FROM book EXCEPT SELECT T1.type , T1.title FROM book AS T1 JOIN review AS T2 ON T1.Book_ID = T2.Book_ID;
What are the type and title of the books that are not rated?
restaurant_bills
SELECT count(*) FROM customer
How many customers are there?
restaurant_bills
SELECT count(*) FROM customer
Count the number of customers.
restaurant_bills
SELECT Name FROM customer ORDER BY Level_of_Membership ASC
List the names of customers in ascending order of level of membership.
restaurant_bills
SELECT Name FROM customer ORDER BY Level_of_Membership ASC
Sort all the customers by the level of membership in ascending order, and return the customer names.
restaurant_bills
SELECT Nationality , Card_Credit FROM customer
What are the nationalities and card credits of customers?
restaurant_bills
SELECT Nationality , Card_Credit FROM customer
Find the nationality and card credit of each customer.
restaurant_bills
SELECT Name FROM customer WHERE Nationality = "England" OR Nationality = "Australia"
Show the names of customers with nationality "England" or "Australia".
restaurant_bills
SELECT Name FROM customer WHERE Nationality = "England" OR Nationality = "Australia"
Which customers have nationality "England" or "Australia"? Give me their names.
restaurant_bills
SELECT avg(Card_Credit) FROM customer WHERE Level_of_Membership > 1
What is the average card credit of customers with membership level higher than 1?
restaurant_bills
SELECT avg(Card_Credit) FROM customer WHERE Level_of_Membership > 1
Find the average card credit customers whose membership level is above 1.
restaurant_bills
SELECT Card_Credit FROM customer ORDER BY Level_of_Membership DESC LIMIT 1
What is the card credit of the customer with the highest membership level?
restaurant_bills
SELECT Card_Credit FROM customer ORDER BY Level_of_Membership DESC LIMIT 1
Find the customer with the highest membership level and return his or her card credit.
restaurant_bills
SELECT Nationality , COUNT(*) FROM customer GROUP BY Nationality
Show different nationalities of customers, along with the number of customers of each nationality.
restaurant_bills
SELECT Nationality , COUNT(*) FROM customer GROUP BY Nationality
How many customers are associated with each nationality? List the nationality and the number of customers.
restaurant_bills
SELECT Nationality FROM customer GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
Show the most common nationality of customers.
restaurant_bills
SELECT Nationality FROM customer GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
Which nationality does the most customers have?
restaurant_bills
SELECT Nationality FROM customer WHERE Card_Credit < 50 INTERSECT SELECT Nationality FROM customer WHERE Card_Credit > 75
Show the nations that have both customers with card credit smaller than 50 and customers with card credit bigger than 75.
restaurant_bills
SELECT Nationality FROM customer WHERE Card_Credit < 50 INTERSECT SELECT Nationality FROM customer WHERE Card_Credit > 75
Which nations have both customers with card credit above 50 and customers with card credit below 75.
restaurant_bills
SELECT T1.Name , T2.Dish_Name FROM customer AS T1 JOIN customer_order AS T2 ON T1.Customer_ID = T2.Customer_ID
Show the names of customers and names of dishes they order.
restaurant_bills
SELECT T1.Name , T2.Dish_Name FROM customer AS T1 JOIN customer_order AS T2 ON T1.Customer_ID = T2.Customer_ID
For each order, return the customer name and the dish name.
restaurant_bills
SELECT T1.Name , T2.Dish_Name FROM customer AS T1 JOIN customer_order AS T2 ON T1.Customer_ID = T2.Customer_ID ORDER BY T2.Quantity DESC
Show the names of customers and names of dishes they order, in descending order of the quantity of dish.
restaurant_bills
SELECT T1.Name , T2.Dish_Name FROM customer AS T1 JOIN customer_order AS T2 ON T1.Customer_ID = T2.Customer_ID ORDER BY T2.Quantity DESC
For each order, find the customer name and the dish name. Sort the result in descending order of the quantity of dish.
restaurant_bills
SELECT T1.Name , sum(T2.Quantity) FROM customer AS T1 JOIN customer_order AS T2 ON T1.Customer_ID = T2.Customer_ID GROUP BY T1.Name
Show each customer name and the total quantities of dishes ordered by that customer.
restaurant_bills
select t1.name , sum(t2.quantity) from customer as t1 join customer_order as t2 on t1.customer_id = t2.customer_id group by t1.name
What is the total quantities of dishes ordered by each customer ? List the customer name and the total quantity .
restaurant_bills
SELECT T1.Name FROM customer AS T1 JOIN customer_order AS T2 ON T1.Customer_ID = T2.Customer_ID GROUP BY T1.Name HAVING sum(T2.Quantity) > 1
Show the customers with total quantity of order bigger than 1.
restaurant_bills
SELECT T1.Name FROM customer AS T1 JOIN customer_order AS T2 ON T1.Customer_ID = T2.Customer_ID GROUP BY T1.Name HAVING sum(T2.Quantity) > 1
Which customers have total order quantity greater than 1? Give me the customer names.
restaurant_bills
SELECT DISTINCT Manager FROM branch
Show distinct managers of branches.
restaurant_bills
SELECT DISTINCT Manager FROM branch
Who are the distinct managers of branches?
restaurant_bills
SELECT name FROM customer WHERE Customer_ID NOT IN (SELECT Customer_ID FROM customer_order)
List the names of customers that do not have any order.
restaurant_bills
SELECT name FROM customer WHERE Customer_ID NOT IN (SELECT Customer_ID FROM customer_order)
Which customers do not have any order? Give me the customer names.
club_leader
SELECT count(*) FROM member
How many members are there?
club_leader
SELECT Name FROM member ORDER BY Age ASC
List the names of members in ascending order of age.
club_leader
SELECT Name , Nationality FROM member
What are the names and nationalities of the members?
club_leader
select name from member where nationality != "england"
List the names of members whose nationality is not `` England '' .
club_leader
SELECT Name FROM member WHERE Age = 19 OR Age = 20
Show the names of members whose age is either 19 or 20.
club_leader
SELECT Name FROM member ORDER BY Age DESC LIMIT 1
What is the name of the oldest member?
club_leader
SELECT Nationality , COUNT(*) FROM member GROUP BY Nationality
Show different nationalities along with the number of members of each nationality.
club_leader
SELECT Nationality , COUNT(*) FROM member GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
Please show the most common nationality of members.
club_leader
SELECT Nationality FROM member GROUP BY Nationality HAVING COUNT(*) >= 2
Show the nations that have at least two members.
club_leader
SELECT T3.Name , T2.Club_Name FROM club_leader AS T1 JOIN club AS T2 ON T1.Club_ID = T2.Club_ID JOIN member AS T3 ON T1.Member_ID = T3.Member_ID
Show the names of club leaders and the names of clubs they joined.
club_leader
SELECT T3.Name , T2.Club_Name FROM club_leader AS T1 JOIN club AS T2 ON T1.Club_ID = T2.Club_ID JOIN member AS T3 ON T1.Member_ID = T3.Member_ID WHERE T2.Overall_Ranking < 100
Show the names of club leaders of clubs with overall ranking higher than 100.
club_leader
SELECT T3.Name , T2.Club_Name FROM club_leader AS T1 JOIN club AS T2 ON T1.Club_ID = T2.Club_ID JOIN member AS T3 ON T1.Member_ID = T3.Member_ID WHERE T1.Year_Join < 2018
Show the names of club leaders that joined their club before 2018.
club_leader
SELECT T3.Name FROM club_leader AS T1 JOIN club AS T2 ON T1.Club_ID = T2.Club_ID JOIN member AS T3 ON T1.Member_ID = T3.Member_ID WHERE T2.Club_Name = "Houston"
Show the name of the leader of the club named "Houston".
club_leader
SELECT Name FROM member WHERE Member_ID NOT IN (SELECT Member_ID FROM club_leader)
List the names of members that are not club leaders.
club_leader
SELECT Nationality FROM member WHERE Age > 22 INTERSECT SELECT Nationality FROM member WHERE Age < 19
Show the nations that have both members older than 22 and members younger than 19.
club_leader
SELECT avg(T2.age) FROM club_leader AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id
What is the average age of all the club leaders?
club_leader
SELECT club_name FROM club WHERE club_name LIKE '%state%'
Which club name contains the string 'state'?
cre_Doc_and_collections
SELECT Collection_Subset_Name FROM Collection_Subsets;
List all collections' subset. List the subsets' names.
cre_Doc_and_collections
SELECT Collection_Subset_Name FROM Collection_Subsets;
What are the collection susbset names?
cre_Doc_and_collections
SELECT Collecrtion_Subset_Details FROM Collection_Subsets WHERE Collection_Subset_Name = "Top collection";
What is detail of collection subset with name 'Top collection'?
cre_Doc_and_collections
SELECT Collecrtion_Subset_Details FROM Collection_Subsets WHERE Collection_Subset_Name = "Top collection";
What collection details are there on the subset named 'Top collection'?
cre_Doc_and_collections
SELECT Document_Subset_Name FROM Document_Subsets;
List all documents's subset. List the subset's name.
cre_Doc_and_collections
SELECT Document_Subset_Name FROM Document_Subsets;
What are the document subset names?
cre_Doc_and_collections
SELECT Document_Subset_Details FROM Document_Subsets WHERE Document_Subset_Name = "Best for 2000";
What is the detail of document subset with name 'Best for 2000'?
cre_Doc_and_collections
SELECT Document_Subset_Details FROM Document_Subsets WHERE Document_Subset_Name = "Best for 2000";
What are the details on the document subsets that are named 'Best for 2000'?
cre_Doc_and_collections
SELECT Document_Object_ID FROM Document_Objects;
List document id of all documents.
cre_Doc_and_collections
SELECT Document_Object_ID FROM Document_Objects;
What is the object id of the document objects?
cre_Doc_and_collections
SELECT Parent_Document_Object_ID FROM Document_Objects WHERE OWNER = 'Marlin'
What is the parent document of document owned by Marlin? List the document id.
cre_Doc_and_collections
SELECT Parent_Document_Object_ID FROM Document_Objects WHERE OWNER = 'Marlin'
What are the document object ids of the objects owned by Marlin?
cre_Doc_and_collections
SELECT OWNER FROM Document_Objects WHERE Description = 'Braeden Collection'
What is the owner of document with the Description 'Braeden Collection'?
cre_Doc_and_collections
SELECT OWNER FROM Document_Objects WHERE Description = 'Braeden Collection'
What are the owners of the document objects described as the 'Braeden Collection'?
cre_Doc_and_collections
SELECT T2.Owner FROM Document_Objects AS T1 JOIN Document_Objects AS T2 ON T1.Parent_Document_Object_ID = T2.Document_Object_ID WHERE T1.Owner = 'Marlin'
What is the owner of the parent document of document owned by 'Marlin'?
cre_Doc_and_collections
SELECT T2.Owner FROM Document_Objects AS T1 JOIN Document_Objects AS T2 ON T1.Parent_Document_Object_ID = T2.Document_Object_ID WHERE T1.Owner = 'Marlin'
Who is the owner of the parent document of every documents where 'Marlin' is the owner?
cre_Doc_and_collections
SELECT DISTINCT T2.Description FROM Document_Objects AS T1 JOIN Document_Objects AS T2 ON T1.Parent_Document_Object_ID = T2.Document_Object_ID
What are the different descriptions of all the parent documents?
cre_Doc_and_collections
SELECT DISTINCT T2.Description FROM Document_Objects AS T1 JOIN Document_Objects AS T2 ON T1.Parent_Document_Object_ID = T2.Document_Object_ID
What is the unique description of every parent document?
cre_Doc_and_collections
SELECT count(*) FROM Document_Objects WHERE OWNER = "Marlin";
How many documents owned by Marlin?
cre_Doc_and_collections
SELECT count(*) FROM Document_Objects WHERE OWNER = "Marlin";
What is the count of documents owned by Marlin?
cre_Doc_and_collections
SELECT Document_Object_ID FROM Document_Objects EXCEPT SELECT Parent_Document_Object_ID FROM Document_Objects
List all documents ids that are not the parent of other documents.
cre_Doc_and_collections
SELECT Document_Object_ID FROM Document_Objects EXCEPT SELECT Parent_Document_Object_ID FROM Document_Objects
What are the ids of the documents that are not parent documents?
cre_Doc_and_collections
SELECT T2.Document_Object_ID , count(*) FROM Document_Objects AS T1 JOIN Document_Objects AS T2 ON T1.Parent_Document_Object_ID = T2.Document_Object_ID GROUP BY T2.Document_Object_ID;
How many child documents does each parent document has? List the document id and the number.
cre_Doc_and_collections
SELECT T2.Document_Object_ID , count(*) FROM Document_Objects AS T1 JOIN Document_Objects AS T2 ON T1.Parent_Document_Object_ID = T2.Document_Object_ID GROUP BY T2.Document_Object_ID;
What is the number of child documents for each parent document, and what are the ids of the parent documents?
cre_Doc_and_collections
SELECT Collection_Name FROM Collections;
List the name of all collections.
cre_Doc_and_collections
SELECT Collection_Name FROM Collections;
what are the collection names?
cre_Doc_and_collections
SELECT Collection_Description FROM Collections WHERE Collection_Name = "Best";
What is the description of collection named Best?
cre_Doc_and_collections
SELECT Collection_Description FROM Collections WHERE Collection_Name = "Best";
What are the collection descriptions that are named as 'Best'?
cre_Doc_and_collections
SELECT T2.Collection_Name FROM Collections AS T1 JOIN Collections AS T2 ON T1.Parent_Collection_ID = T2.Collection_ID WHERE T1.Collection_Name = "Nice";
What is the name of the parent collection of the collection named Nice?
cre_Doc_and_collections
SELECT T2.Collection_Name FROM Collections AS T1 JOIN Collections AS T2 ON T1.Parent_Collection_ID = T2.Collection_ID WHERE T1.Collection_Name = "Nice";
What are the names of all parent collections of the collection named Nice?
cre_Doc_and_collections
SELECT Collection_Name FROM Collections EXCEPT SELECT T2.Collection_Name FROM Collections AS T1 JOIN Collections AS T2 ON T1.Parent_Collection_ID = T2.Collection_ID;
Which collection is not the parent of other collection? List the collection's name.
cre_Doc_and_collections
SELECT Collection_Name FROM Collections EXCEPT SELECT T2.Collection_Name FROM Collections AS T1 JOIN Collections AS T2 ON T1.Parent_Collection_ID = T2.Collection_ID;
What are the names of the collections that are not the parent of the other collections?
cre_Doc_and_collections
SELECT T2.Document_Object_ID FROM Document_Objects AS T1 JOIN Document_Objects AS T2 ON T1.Parent_Document_Object_ID = T2.Document_Object_ID GROUP BY T2.Document_Object_ID HAVING count(*) > 1;
List document that have more than one child. List the document id.
cre_Doc_and_collections
SELECT T2.Document_Object_ID FROM Document_Objects AS T1 JOIN Document_Objects AS T2 ON T1.Parent_Document_Object_ID = T2.Document_Object_ID GROUP BY T2.Document_Object_ID HAVING count(*) > 1;
What are the ids of the documents that have more than one child?
cre_Doc_and_collections
SELECT count(*) FROM Collections AS T1 JOIN Collections AS T2 ON T1.Parent_Collection_ID = T2.Collection_ID WHERE T2.Collection_Name = "Best";
How many child collection does the collection named Best has?
cre_Doc_and_collections
SELECT count(*) FROM Collections AS T1 JOIN Collections AS T2 ON T1.Parent_Collection_ID = T2.Collection_ID WHERE T2.Collection_Name = "Best";
What is the number of child collections belonging to the collection named Best?
cre_Doc_and_collections
select t1.document_object_id from document_subset_members as t1 join document_objects as t2 on t1.document_object_id = t2.document_object_id where t2.owner = 'ransom'
List all document which is related to document owned by Ransom . List the document id .
cre_Doc_and_collections
select t1.document_object_id from document_subset_members as t1 join document_objects as t2 on t1.document_object_id = t2.document_object_id where t2.owner = 'ransom'
What are the document object ids of the related to the document owned by Ransom ?
cre_Doc_and_collections
SELECT T2.Collection_Subset_ID , T1.Collection_Subset_Name , count(*) FROM Collection_Subsets AS T1 JOIN Collection_Subset_Members AS T2 ON T1.Collection_Subset_ID = T2.Collection_Subset_ID GROUP BY T2.Collection_Subset_ID;
List collection subset id, name and number of collections in each subset.