query_id
int64
0
2.15k
database_id
stringclasses
40 values
table_id
listlengths
1
4
query
stringlengths
22
185
answer
stringlengths
22
608
difficulty
stringclasses
4 values
600
book_review
[ "book", "review" ]
What are the titles and ratings of books?
SELECT T1.Title , T2.Rating FROM book AS T1 JOIN review AS T2 ON T1.Book_ID = T2.Book_ID
medium
601
book_review
[ "book", "review" ]
What is the rating of the book with the largest number of chapters?
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
hard
602
book_review
[ "book", "review" ]
What is the rank of the book with the smallest number of pages?
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
hard
603
book_review
[ "book", "review" ]
What is the title of the book with the highest rank in the 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
hard
604
book_review
[ "book", "review" ]
What is the average number of readers for books of type "Novel"?
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"
medium
605
book_review
[ "book" ]
For each book type return the type and the number of books of that type.
SELECT TYPE , COUNT(*) FROM book GROUP BY TYPE
medium
606
book_review
[ "book" ]
What is the most common type of books?
SELECT TYPE FROM book GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
hard
607
book_review
[ "book" ]
What are the types of books that have at least three books belonging to?
SELECT TYPE FROM book GROUP BY TYPE HAVING COUNT(*) >= 3
easy
608
book_review
[ "book", "review" ]
List the titles of books in ascending order of the ratings in review?
SELECT T1.Title FROM book AS T1 JOIN review AS T2 ON T1.Book_ID = T2.Book_ID ORDER BY T2.Rating ASC
medium
609
book_review
[ "book", "review" ]
List the title and audio length for all the books in descending order of the number of readers.
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
medium
610
book_review
[ "book", "review" ]
How many books do not have reviews?
SELECT count(*) FROM book WHERE Book_ID NOT IN (SELECT Book_ID FROM review)
extra
611
book_review
[ "book" ]
Show the types of books that have both books with more than 75 chapters and books with less than 50 chapters.
SELECT TYPE FROM book WHERE Chapters > 75 INTERSECT SELECT TYPE FROM book WHERE Chapters < 50
hard
612
book_review
[ "book" ]
How many distinct types of book are there?
SELECT count(DISTINCT TYPE) FROM book
easy
613
book_review
[ "book", "review" ]
What are the type and title of the books that are not rated?
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;
extra
614
restaurant_bills
[ "customer" ]
How many customers are there?
SELECT count(*) FROM customer
easy
615
restaurant_bills
[ "customer" ]
Count the number of customers.
SELECT count(*) FROM customer
easy
616
restaurant_bills
[ "customer" ]
List the names of customers in ascending order of level of membership.
SELECT Name FROM customer ORDER BY Level_of_Membership ASC
easy
617
restaurant_bills
[ "customer" ]
Sort all the customers by the level of membership in ascending order, and return the customer names.
SELECT Name FROM customer ORDER BY Level_of_Membership ASC
easy
618
restaurant_bills
[ "customer" ]
What are the nationalities and card credits of customers?
SELECT Nationality , Card_Credit FROM customer
medium
619
restaurant_bills
[ "customer" ]
Find the nationality and card credit of each customer.
SELECT Nationality , Card_Credit FROM customer
medium
620
restaurant_bills
[ "customer" ]
Show the names of customers with nationality "England" or "Australia".
SELECT Name FROM customer WHERE Nationality = "England" OR Nationality = "Australia"
medium
621
restaurant_bills
[ "customer" ]
Which customers have nationality "England" or "Australia"? Give me their names.
SELECT Name FROM customer WHERE Nationality = "England" OR Nationality = "Australia"
medium
622
restaurant_bills
[ "customer" ]
What is the average card credit of customers with membership level higher than 1?
SELECT avg(Card_Credit) FROM customer WHERE Level_of_Membership > 1
easy
623
restaurant_bills
[ "customer" ]
Find the average card credit customers whose membership level is above 1.
SELECT avg(Card_Credit) FROM customer WHERE Level_of_Membership > 1
easy
624
restaurant_bills
[ "customer" ]
What is the card credit of the customer with the highest membership level?
SELECT Card_Credit FROM customer ORDER BY Level_of_Membership DESC LIMIT 1
medium
625
restaurant_bills
[ "customer" ]
Find the customer with the highest membership level and return his or her card credit.
SELECT Card_Credit FROM customer ORDER BY Level_of_Membership DESC LIMIT 1
medium
626
restaurant_bills
[ "customer" ]
Show different nationalities of customers, along with the number of customers of each nationality.
SELECT Nationality , COUNT(*) FROM customer GROUP BY Nationality
medium
627
restaurant_bills
[ "customer" ]
How many customers are associated with each nationality? List the nationality and the number of customers.
SELECT Nationality , COUNT(*) FROM customer GROUP BY Nationality
medium
628
restaurant_bills
[ "customer" ]
Show the most common nationality of customers.
SELECT Nationality FROM customer GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
hard
629
restaurant_bills
[ "customer" ]
Which nationality does the most customers have?
SELECT Nationality FROM customer GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
hard
630
restaurant_bills
[ "customer" ]
Show the nations that have both customers with card credit smaller than 50 and customers with card credit bigger than 75.
SELECT Nationality FROM customer WHERE Card_Credit < 50 INTERSECT SELECT Nationality FROM customer WHERE Card_Credit > 75
hard
631
restaurant_bills
[ "customer" ]
Which nations have both customers with card credit above 50 and customers with card credit below 75.
SELECT Nationality FROM customer WHERE Card_Credit < 50 INTERSECT SELECT Nationality FROM customer WHERE Card_Credit > 75
hard
632
restaurant_bills
[ "customer_order", "customer" ]
Show the names of customers and names of dishes they order.
SELECT T1.Name , T2.Dish_Name FROM customer AS T1 JOIN customer_order AS T2 ON T1.Customer_ID = T2.Customer_ID
medium
633
restaurant_bills
[ "customer_order", "customer" ]
For each order, return the customer name and the dish name.
SELECT T1.Name , T2.Dish_Name FROM customer AS T1 JOIN customer_order AS T2 ON T1.Customer_ID = T2.Customer_ID
medium
634
restaurant_bills
[ "customer_order", "customer" ]
Show the names of customers and names of dishes they order, in descending order of the quantity of dish.
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
medium
635
restaurant_bills
[ "customer_order", "customer" ]
For each order, find the customer name and the dish name. Sort the result in descending order of the quantity of dish.
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
medium
636
restaurant_bills
[ "customer_order", "customer" ]
Show each customer name and the total quantities of dishes ordered by that customer.
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
medium
637
restaurant_bills
[ "customer_order", "customer" ]
What is the total quantities of dishes ordered by each customer ? List the customer name and the total quantity .
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
medium
638
restaurant_bills
[ "customer_order", "customer" ]
Show the customers with total quantity of order bigger than 1.
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
medium
639
restaurant_bills
[ "customer_order", "customer" ]
Which customers have total order quantity greater than 1? Give me the customer names.
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
medium
640
restaurant_bills
[ "branch" ]
Show distinct managers of branches.
SELECT DISTINCT Manager FROM branch
easy
641
restaurant_bills
[ "branch" ]
Who are the distinct managers of branches?
SELECT DISTINCT Manager FROM branch
easy
642
restaurant_bills
[ "customer_order", "customer" ]
List the names of customers that do not have any order.
SELECT name FROM customer WHERE Customer_ID NOT IN (SELECT Customer_ID FROM customer_order)
hard
643
restaurant_bills
[ "customer_order", "customer" ]
Which customers do not have any order? Give me the customer names.
SELECT name FROM customer WHERE Customer_ID NOT IN (SELECT Customer_ID FROM customer_order)
hard
644
club_leader
[ "member" ]
How many members are there?
SELECT count(*) FROM member
easy
645
club_leader
[ "member" ]
List the names of members in ascending order of age.
SELECT Name FROM member ORDER BY Age ASC
easy
646
club_leader
[ "member" ]
What are the names and nationalities of the members?
SELECT Name , Nationality FROM member
medium
647
club_leader
[ "member" ]
List the names of members whose nationality is not `` England '' .
select name from member where nationality != "england"
easy
648
club_leader
[ "member" ]
Show the names of members whose age is either 19 or 20.
SELECT Name FROM member WHERE Age = 19 OR Age = 20
medium
649
club_leader
[ "member" ]
What is the name of the oldest member?
SELECT Name FROM member ORDER BY Age DESC LIMIT 1
medium
650
club_leader
[ "member" ]
Show different nationalities along with the number of members of each nationality.
SELECT Nationality , COUNT(*) FROM member GROUP BY Nationality
medium
651
club_leader
[ "member" ]
Please show the most common nationality of members.
SELECT Nationality , COUNT(*) FROM member GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
hard
652
club_leader
[ "member" ]
Show the nations that have at least two members.
SELECT Nationality FROM member GROUP BY Nationality HAVING COUNT(*) >= 2
easy
653
club_leader
[ "club_leader", "member", "club" ]
Show the names of club leaders and the names of clubs they joined.
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
medium
654
club_leader
[ "club_leader", "member", "club" ]
Show the names of club leaders of clubs with overall ranking higher than 100.
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
hard
655
club_leader
[ "club_leader", "member", "club" ]
Show the names of club leaders that joined their club before 2018.
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
hard
656
club_leader
[ "club_leader", "member", "club" ]
Show the name of the leader of the club named "Houston".
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"
hard
657
club_leader
[ "club_leader", "member" ]
List the names of members that are not club leaders.
SELECT Name FROM member WHERE Member_ID NOT IN (SELECT Member_ID FROM club_leader)
hard
658
club_leader
[ "member" ]
Show the nations that have both members older than 22 and members younger than 19.
SELECT Nationality FROM member WHERE Age > 22 INTERSECT SELECT Nationality FROM member WHERE Age < 19
hard
659
club_leader
[ "club_leader", "member" ]
What is the average age of all the club leaders?
SELECT avg(T2.age) FROM club_leader AS T1 JOIN member AS T2 ON T1.member_id = T2.member_id
easy
660
club_leader
[ "club" ]
Which club name contains the string 'state'?
SELECT club_name FROM club WHERE club_name LIKE '%state%'
medium
661
cre_Doc_and_collections
[ "collection_subsets" ]
List all collections' subset. List the subsets' names.
SELECT Collection_Subset_Name FROM Collection_Subsets;
easy
662
cre_Doc_and_collections
[ "collection_subsets" ]
What are the collection susbset names?
SELECT Collection_Subset_Name FROM Collection_Subsets;
easy
663
cre_Doc_and_collections
[ "collection_subsets" ]
What is detail of collection subset with name 'Top collection'?
SELECT Collecrtion_Subset_Details FROM Collection_Subsets WHERE Collection_Subset_Name = "Top collection";
easy
664
cre_Doc_and_collections
[ "collection_subsets" ]
What collection details are there on the subset named 'Top collection'?
SELECT Collecrtion_Subset_Details FROM Collection_Subsets WHERE Collection_Subset_Name = "Top collection";
easy
665
cre_Doc_and_collections
[ "document_subsets" ]
List all documents's subset. List the subset's name.
SELECT Document_Subset_Name FROM Document_Subsets;
easy
666
cre_Doc_and_collections
[ "document_subsets" ]
What are the document subset names?
SELECT Document_Subset_Name FROM Document_Subsets;
easy
667
cre_Doc_and_collections
[ "document_subsets" ]
What is the detail of document subset with name 'Best for 2000'?
SELECT Document_Subset_Details FROM Document_Subsets WHERE Document_Subset_Name = "Best for 2000";
easy
668
cre_Doc_and_collections
[ "document_subsets" ]
What are the details on the document subsets that are named 'Best for 2000'?
SELECT Document_Subset_Details FROM Document_Subsets WHERE Document_Subset_Name = "Best for 2000";
easy
669
cre_Doc_and_collections
[ "document_objects" ]
List document id of all documents.
SELECT Document_Object_ID FROM Document_Objects;
easy
670
cre_Doc_and_collections
[ "document_objects" ]
What is the object id of the document objects?
SELECT Document_Object_ID FROM Document_Objects;
easy
671
cre_Doc_and_collections
[ "document_objects" ]
What is the parent document of document owned by Marlin? List the document id.
SELECT Parent_Document_Object_ID FROM Document_Objects WHERE OWNER = 'Marlin'
easy
672
cre_Doc_and_collections
[ "document_objects" ]
What are the document object ids of the objects owned by Marlin?
SELECT Parent_Document_Object_ID FROM Document_Objects WHERE OWNER = 'Marlin'
easy
673
cre_Doc_and_collections
[ "document_objects" ]
What is the owner of document with the Description 'Braeden Collection'?
SELECT OWNER FROM Document_Objects WHERE Description = 'Braeden Collection'
easy
674
cre_Doc_and_collections
[ "document_objects" ]
What are the owners of the document objects described as the 'Braeden Collection'?
SELECT OWNER FROM Document_Objects WHERE Description = 'Braeden Collection'
easy
675
cre_Doc_and_collections
[ "document_objects" ]
What is the owner of the parent document of document owned by 'Marlin'?
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'
medium
676
cre_Doc_and_collections
[ "document_objects" ]
Who is the owner of the parent document of every documents where 'Marlin' is the owner?
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'
medium
677
cre_Doc_and_collections
[ "document_objects" ]
What are the different descriptions of all the parent documents?
SELECT DISTINCT T2.Description FROM Document_Objects AS T1 JOIN Document_Objects AS T2 ON T1.Parent_Document_Object_ID = T2.Document_Object_ID
easy
678
cre_Doc_and_collections
[ "document_objects" ]
What is the unique description of every parent document?
SELECT DISTINCT T2.Description FROM Document_Objects AS T1 JOIN Document_Objects AS T2 ON T1.Parent_Document_Object_ID = T2.Document_Object_ID
easy
679
cre_Doc_and_collections
[ "document_objects" ]
How many documents owned by Marlin?
SELECT count(*) FROM Document_Objects WHERE OWNER = "Marlin";
easy
680
cre_Doc_and_collections
[ "document_objects" ]
What is the count of documents owned by Marlin?
SELECT count(*) FROM Document_Objects WHERE OWNER = "Marlin";
easy
681
cre_Doc_and_collections
[ "document_objects" ]
List all documents ids that are not the parent of other documents.
SELECT Document_Object_ID FROM Document_Objects EXCEPT SELECT Parent_Document_Object_ID FROM Document_Objects
hard
682
cre_Doc_and_collections
[ "document_objects" ]
What are the ids of the documents that are not parent documents?
SELECT Document_Object_ID FROM Document_Objects EXCEPT SELECT Parent_Document_Object_ID FROM Document_Objects
hard
683
cre_Doc_and_collections
[ "document_objects" ]
How many child documents does each parent document has? List the document id and the number.
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;
medium
684
cre_Doc_and_collections
[ "document_objects" ]
What is the number of child documents for each parent document, and what are the ids of the parent documents?
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;
medium
685
cre_Doc_and_collections
[ "collections" ]
List the name of all collections.
SELECT Collection_Name FROM Collections;
easy
686
cre_Doc_and_collections
[ "collections" ]
what are the collection names?
SELECT Collection_Name FROM Collections;
easy
687
cre_Doc_and_collections
[ "collections" ]
What is the description of collection named Best?
SELECT Collection_Description FROM Collections WHERE Collection_Name = "Best";
easy
688
cre_Doc_and_collections
[ "collections" ]
What are the collection descriptions that are named as 'Best'?
SELECT Collection_Description FROM Collections WHERE Collection_Name = "Best";
easy
689
cre_Doc_and_collections
[ "collections" ]
What is the name of the parent collection of the collection named Nice?
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";
medium
690
cre_Doc_and_collections
[ "collections" ]
What are the names of all parent collections of the collection named Nice?
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";
medium
691
cre_Doc_and_collections
[ "collections" ]
Which collection is not the parent of other collection? List the collection's name.
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;
hard
692
cre_Doc_and_collections
[ "collections" ]
What are the names of the collections that are not the parent of the other 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;
hard
693
cre_Doc_and_collections
[ "document_objects" ]
List document that have more than one child. List the document id.
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;
medium
694
cre_Doc_and_collections
[ "document_objects" ]
What are the ids of the documents that have more than one child?
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;
medium
695
cre_Doc_and_collections
[ "collections" ]
How many child collection does the collection named Best has?
SELECT count(*) FROM Collections AS T1 JOIN Collections AS T2 ON T1.Parent_Collection_ID = T2.Collection_ID WHERE T2.Collection_Name = "Best";
medium
696
cre_Doc_and_collections
[ "collections" ]
What is the number of child collections belonging to the collection named Best?
SELECT count(*) FROM Collections AS T1 JOIN Collections AS T2 ON T1.Parent_Collection_ID = T2.Collection_ID WHERE T2.Collection_Name = "Best";
medium
697
cre_Doc_and_collections
[ "document_subset_members", "document_objects" ]
List all document which is related to document owned by Ransom . List the document id .
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'
medium
698
cre_Doc_and_collections
[ "document_subset_members", "document_objects" ]
What are the document object ids of the related to the document owned by Ransom ?
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'
medium
699
cre_Doc_and_collections
[ "collection_subsets", "collection_subset_members" ]
List collection subset id, name and number of collections in each subset.
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;
medium