db_id
stringclasses 69
values | question
stringlengths 24
325
| evidence
stringlengths 0
673
| SQL
stringlengths 23
804
| question_id
int64 0
9.43k
| difficulty
stringclasses 1
value |
---|---|---|---|---|---|
airline
|
What are the destinations of the flights with air carrier description "Southeast Alaska Airlines: WEB"?
|
destinations refers to DEST; Southeast Alaska Airlines: WEB refers to Description = 'Southeast Alaska Airlines: WEB';
|
SELECT T2.DEST FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Southeast Alaska Airlines: WEB'
| 5,900 | |
airline
|
From August 10 to August 20, 2018, how many cancelled flights of air carrier named Spirit Air Lines: NK are there?
|
From August 10 to August 20, 2018 refers to FL_DATE BETWEEN '2018/8/10' AND '2018/8/20'; cancelled flights refers to CANCELLED = 1; Trans Southern Airways: 'Spirit Air Lines: NK' refers to Description = 'Spirit Air Lines: NK';
|
SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Spirit Air Lines: NK' AND T2.CANCELLED = 0 AND T2.FL_DATE BETWEEN '2018/8/10' AND '2018/8/20'
| 5,901 | |
airline
|
What is the total number of flights that flew on August 2, 2018 with air carrier described as Horizon Air?
|
on August 2, 2018 refers to FL_DATE = '2018/8/2'; Horizon Air refers to Description which includs 'Horizon Air';
|
SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description LIKE '%Horizon Air%' AND T2.FL_DATE = '2018/8/2'
| 5,902 | |
airline
|
What is the tail number of the flight with air carrier named Iscargo Hf: ICQ and arrival time of 1000 and below?
|
tail number refers to TAIL_NUM; Iscargo Hf: ICQ refers to Description = 'Iscargo Hf: ICQ'; arrival time of 1000 and below refers to ARR_TIME < = 1000;
|
SELECT T2.TAIL_NUM FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.ARR_TIME <= 1000 AND T1.Description = 'Iscargo Hf: ICQ'
| 5,903 | |
airline
|
List the flight date of flights with air carrier described as Profit Airlines Inc.: XBH which have an actual elapsed time below 100.
|
flight date refers to FL_DATE; Profit Airlines Inc.: XBH refers to Description = 'Profit Airlines Inc.: XBH'; actual elapsed time below 100 refers to ACTUAL_ELAPSED_TIME < 100;
|
SELECT T2.FL_DATE FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.ACTUAL_ELAPSED_TIME < 100 AND T1.Description = 'Profit Airlines Inc.: XBH'
| 5,904 | |
airline
|
Among the flights with air carrier named Republic Airline, how many of the flights have departure delay of 30 minutes and above?
|
Republic Airline refers to Description which contains 'Republic Airline'; departure delay of 30 minutes and above refers to DEP_DELAY > 30;
|
SELECT COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description LIKE '%Republic Airline%' AND T2.DEP_DELAY > 30
| 5,905 | |
airline
|
What are the air carriers of the flights that flew on August 25, 2018 that have departure delay of -5?
|
on August 25, 2018 refers to FL_DATE = '2018/8/25'; departure delay of -5 refers to DEP_DELAY = -5;
|
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.FL_DATE = '2018/8/25' GROUP BY T1.Description
| 5,906 | |
airline
|
Provide the air carrier description of the flight with a tail number N922US from Phoenix.
|
tail number refers to TAIL_NUM; TAIL_NUM = 'N922US'; from Phoenix refers to ORIGIN = 'PHX';
|
SELECT T2.Description FROM Airlines AS T1 INNER JOIN `Air Carriers` AS T2 ON T2.Code = T1.OP_CARRIER_AIRLINE_ID WHERE T1.TAIL_NUM = 'N922US' AND T1.ORIGIN = 'PHX' GROUP BY T2.Description
| 5,907 | |
airline
|
Give the air carrier description of the flights that have an earlier arrival and departure.
|
earlier arrival and departure refers to ARR_DELAY < 0 AND DEP_DELAY < 0;
|
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.ARR_DELAY < 0 AND T2.DEP_DELAY < 0 GROUP BY T1.Description
| 5,908 | |
airline
|
Among the flights with air carrier "Southwest Airlines Co.: WN", provide the tail number of flights with an actual elapsed time lower than the 80% of the average actual elapsed time of listed flights.
|
Southwest Airlines Co.: WN refers to Description = 'Southwest Airlines Co.: WN'; tail number refers to TAIL_NUM; actual elapsed time lower than the 80% of the average actual elapsed time refers to ACTUAL_ELAPSED_TIME < (MULTIPLY AVG(ACTUAL_ELAPSED_TIME), 0.8);
|
SELECT T2.TAIL_NUM FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description = 'Southwest Airlines Co.: WN' AND T2.ACTUAL_ELAPSED_TIME < ( SELECT AVG(ACTUAL_ELAPSED_TIME) * 0.8 FROM Airlines )
| 5,909 | |
airline
|
List the air carrier's description with arrival time lower than the 40% of the average arrival time of flights that flew to Phoenix.
|
arrival time lower than the 40% of the average arrival time refers to ARR_TIME < MULTIPLY(AVG(ARR_TIME), 0.4); flew to Phoenix refers to DEST = 'PHX';
|
SELECT T1.Description FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T2.DEST = 'PHX' AND T2.ARR_TIME < ( SELECT AVG(ARR_TIME) * 0.4 FROM Airlines ) GROUP BY T1.Description
| 5,910 | |
airline
|
Among the flights of the air carrier described as American Airlines, what is the percentage of the flights with earlier departure?
|
American Airlines can be found in Description which contains 'American Airlines'; percentage = MULTIPLY(DIVIDE(SUM(DEP_DELAY < 0), COUNT(DEP_DELAY)), 1.0); earlier departure refers to DEP_DELAY < 0;
|
SELECT CAST(SUM(CASE WHEN T2.DEP_DELAY < 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM `Air Carriers` AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.OP_CARRIER_AIRLINE_ID WHERE T1.Description LIKE '%American Airlines%'
| 5,911 | |
books
|
Among the books published by publisher ID 1929, how many of them have over 500 pages?
|
books have over 500 pages refers to num_pages > 500
|
SELECT COUNT(*) FROM book WHERE publisher_id = 1929 AND num_pages > 500
| 5,912 | |
books
|
What is the publication date of the book with the most pages?
|
book with the most pages refers to Max(num_pages)
|
SELECT publication_date FROM book ORDER BY num_pages DESC LIMIT 1
| 5,913 | |
books
|
What is the name of the publisher of the book "The Illuminati"?
|
"The Illuminati" is the title of the book; name of publisher refers to publisher_name
|
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'The Illuminati'
| 5,914 | |
books
|
How many books were published by publisher "Thomas Nelson"?
|
"Thomas Nelson" is the publisher_name
|
SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Thomas Nelson'
| 5,915 | |
books
|
What is the name of the publisher that has published the most number of books?
|
name of publisher refers to publisher_name; publisher published the most number of books refers to Max(Count(book_id))
|
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name ORDER BY COUNT(T1.book_id) DESC LIMIT 1
| 5,916 | |
books
|
Please give the title of the oldest book published by publisher "Thomas Nelson".
|
"Thomas Nelson" is the publisher_name; oldest book refers to Min(publication_date)
|
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Thomas Nelson' ORDER BY T1.publication_date ASC LIMIT 1
| 5,917 | |
books
|
Among the books published by publisher "Thomas Nelson", how many of them have over 300 pages?
|
"Thomas Nelson" is the publisher_name; books with over 300 pages refers to num_pages > 300
|
SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Thomas Nelson' AND T1.num_pages > 300
| 5,918 | |
books
|
What is the name of the publisher of the book with the most pages?
|
book with the most pages refers to Max(num_pages); name of publisher refers to publisher_name
|
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id ORDER BY T1.num_pages DESC LIMIT 1
| 5,919 | |
books
|
How many books are in English?
|
books in English refers to language_name = 'English'
|
SELECT COUNT(*) FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'English'
| 5,920 | |
books
|
Please list the titles of all the books in British English.
|
"British English" is the language_name of the book
|
SELECT T1.title FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'British English'
| 5,921 | |
books
|
What is the cheapest order price of the book "The Little House"?
|
"The Little House" is the title of book; cheapest order price refers to Min(price)
|
SELECT MIN(T2.price) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'The Little House'
| 5,922 | |
books
|
Please list the titles of all the books that Lucas Wyldbore has ordered.
|
SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Lucas' AND T4.last_name = 'Wyldbore'
| 5,923 | ||
books
|
Among the books ordered by Lucas Wyldbore, how many of them are over 300 pages?
|
books have over 300 pages refers to num_pages > 300
|
SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Lucas' AND T4.last_name = 'Wyldbore' AND T1.num_pages > 300
| 5,924 | |
books
|
What is the total price of all the books ordered by Lucas Wyldbore?
|
total price refers to Sum(price)
|
SELECT SUM(T1.price) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'
| 5,925 | |
books
|
How much money on average does Lucas Wyldbore spend on book orders?
|
average spend on book orders = AVG (price)
|
SELECT SUM(T1.price) / COUNT(*) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'
| 5,926 | |
books
|
Among the books ordered by Lucas Wyldbore, what is the percentage of those books over $13?
|
books over $13 refers to price > 13; percentage = Divide (Sum (order_id where price > 13), Count (order_id)) * 100
|
SELECT CAST(SUM(CASE WHEN T1.price > 13 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'
| 5,927 | |
books
|
Which city does the address id 547 belong to?
|
SELECT city FROM address WHERE address_id = 547
| 5,928 | ||
books
|
How many orders has Cordy Dumbarton made?
|
SELECT COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Cordy' AND T1.last_name = 'Dumbarton'
| 5,929 | ||
books
|
List the title of the earliest published Japanese book.
|
Japanese book refers to language_name = 'Japanese'; earliest published refers to Min(publication_date)
|
SELECT T1.title FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'Japanese' ORDER BY T1.publication_date ASC LIMIT 1
| 5,930 | |
books
|
For the publisher which published the most books, show its name.
|
published the most books refers to Max(Count(book_id)); publisher refers to publisher_name
|
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name ORDER BY COUNT(T2.publisher_id) DESC LIMIT 1
| 5,931 | |
books
|
How many books were published by Kensington?
|
"Kensington" is the publisher_name;
|
SELECT COUNT(T1.book_id) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Kensington'
| 5,932 | |
books
|
Which language was book id 1405 written in?
|
language written in refers to language_name;
|
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.book_id = 1405
| 5,933 | |
books
|
Which customer has made the most orders? Show his/her full name.
|
most order refers to Max(Count(order_id)); customer refers to first_name, last_name
|
SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(*) DESC LIMIT 1
| 5,934 | |
books
|
Name the book title of the bestseller.
|
book title refers to title; best sellers refers to title where Max(count(order_id))
|
SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id GROUP BY T1.title ORDER BY COUNT(T1.title) DESC LIMIT 1
| 5,935 | |
books
|
How many books did David Foster Wallace write?
|
"David Foster Wallace" is the author_name;
|
SELECT COUNT(T1.title) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'David Foster Wallace'
| 5,936 | |
books
|
How many orders does the book "O Xará" have?
|
"O Xará" is the title of the book
|
SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'O Xará'
| 5,937 | |
books
|
Which country does Malina Johnson live in?
|
country refers to country_name
|
SELECT T4.country_name FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T3.address_id = T2.address_id INNER JOIN country AS T4 ON T4.country_id = T3.country_id WHERE T1.first_name = 'Malina' AND T1.last_name = 'Johnson' AND T2.status_id = 2
| 5,938 | |
books
|
Give the number of Ukrainian addresses in the database.
|
Ukrainian address refers to country_name = 'Ukraine'
|
SELECT COUNT(*) FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id WHERE T1.country_name = 'Ukraine'
| 5,939 | |
books
|
Which country does Žirovnica city belong to?
|
"Žirovnica" is the city; country refers to country_name
|
SELECT T1.country_name FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id WHERE T2.city = 'Žirovnica'
| 5,940 | |
books
|
Calculate the percentage of the International shipping orders on 2022/11/10.
|
International shipping order refers to method_name = 'International'; orders on 2022/11/10 refers to order_date LIKE '2022-11-10%'; percentage = Divide (Sum(order_id where method_name = 'International'), Count(order_id)) * 100
|
SELECT CAST(SUM(CASE WHEN T1.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM shipping_method AS T1 INNER JOIN cust_order AS T2 ON T1.method_id = T2.shipping_method_id WHERE T2.order_date LIKE '2022-11-10%'
| 5,941 | |
books
|
What is the average number of pages of David Coward's books?
|
number of pages refers to num_pages; average = Divide (Sum(num_pages), Count(book_id))
|
SELECT AVG(T1.num_pages) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'David Coward'
| 5,942 | |
books
|
What is the cost of the slowest and least expensive shipping method?
|
slowest and least expesive method refers to shipping_method = 'Standard'
|
SELECT method_name FROM shipping_method ORDER BY cost ASC LIMIT 1
| 5,943 | |
books
|
What is the title of the first book that was published in 1900?
|
published in 1900 refers to publication_date LIKE '1900%'; first book refers to Min(publication_date)
|
SELECT title FROM book WHERE STRFTIME('%Y', publication_date) = '1900' ORDER BY publication_date LIMIT 1
| 5,944 | |
books
|
What is the full name of the customer who owns the "[email protected]" e-mail address?
|
"[email protected]" is the email of customer; full name refers to first_name, last_name
|
SELECT first_name, last_name FROM customer WHERE email = '[email protected]'
| 5,945 | |
books
|
How many orders in 2022 have Iran as their destinations?
|
Iran as their destination refers to country_name = 'Iran'; orders in 2022 refers to order_date LIKE '2022%'
|
SELECT COUNT(*) FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id INNER JOIN cust_order AS T3 ON T3.dest_address_id = T2.address_id WHERE T1.country_name = 'Iran' AND STRFTIME('%Y', T3.order_date) = '2022'
| 5,946 | |
books
|
Among Daisey Lamball's orders, how many were shipped via International shipping?
|
via international shipping refers to method_name = 'International'
|
SELECT COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Daisey' AND T1.last_name = 'Lamball' AND T3.method_name = 'International'
| 5,947 | |
books
|
What is the full name of the customer who ordered the most books of all time?
|
customer who ordered the most book refers to customer_id where Max(count(order_id)); full name refers to first_name, last_name
|
SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(*) DESC LIMIT 1
| 5,948 | |
books
|
How many orders did Antonia Poltun return?
|
order returned refers to status_value = 'Returned'
|
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.status_value = 'Returned' AND T4.first_name = 'Antonia' AND T4.last_name = 'Poltun'
| 5,949 | |
books
|
Which shipping method is preferred by customers the most?
|
shipping method preferred the most by customers refers to method_id where Max(Count(method_id)); which shipping method refers to method_name
|
SELECT T2.method_name FROM cust_order AS T1 INNER JOIN shipping_method AS T2 ON T1.shipping_method_id = T2.method_id GROUP BY T2.method_name ORDER BY COUNT(T2.method_id) DESC LIMIT 1
| 5,950 | |
books
|
How many orders were delivered in 2021?
|
delivered refers to status_value = 'Delivered'; in 2021 refers to status_date LIKE '2021%'
|
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Delivered' AND STRFTIME('%Y', T2.status_date) = '2021'
| 5,951 | |
books
|
What is the name of the first book written by J.K Rowling?
|
"J.K Rowling" is the author_name; first published book refers to book_id where Min(publication_date); name of the book refers to title
|
SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'J.K. Rowling' ORDER BY T1.publication_date ASC LIMIT 1
| 5,952 | |
books
|
How many books did A.R. Braunmuller write?
|
"A.R. Braunmuller" is the author_name
|
SELECT COUNT(*) FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id WHERE T1.author_name = 'A.R. Braunmuller'
| 5,953 | |
books
|
What is the name of the publisher who published Agatha Christie's first book?
|
"Agatha Christie" is the author_name; name of publisher refers to publisher_name; first book refers to Min(publication_date)
|
SELECT T4.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'Agatha Christie' ORDER BY T1.publication_date ASC LIMIT 1
| 5,954 | |
books
|
List all the names of the books written by Danielle Steel.
|
"Danielle Steel" is the author_name; name of books refers to title
|
SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Danielle Steel'
| 5,955 | |
books
|
How many books by William Shakespeare were published by Penguin Classics?
|
"William Shakespeare" is the author_name; "Penguin Classics" is the publisher_name
|
SELECT COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'William Shakespeare' AND T4.publisher_name = 'Penguin Classics'
| 5,956 | |
books
|
What is the name of the publisher that published the most books?
|
name of publisher refers to publisher_name; publisher published the most number of books refers to Max(Count(book_id))
|
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name ORDER BY COUNT(T2.publisher_id) DESC LIMIT 1
| 5,957 | |
books
|
What is the total shipping cost of all the orders made by Page Holsey? Indicate how many of the said orders were ordered in 2022.
|
shipping cost refers to cost; ordered in 2022 refers to order_date LIKE '2022%'
|
SELECT SUM(T3.cost) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Page' AND T1.last_name = 'Holsey' AND STRFTIME('%Y', T2.order_date) = '2022'
| 5,958 | |
books
|
What is the name of the publisher with publisher ID 22?
|
name of publisher refers to publisher_name
|
SELECT publisher_name FROM publisher WHERE publisher_id = 22
| 5,959 | |
books
|
How many of the books authored by Al Gore have less than 400 pages?
|
"AI Gore" is the author_name; have less than 400 pages refers to num_pages < 400
|
SELECT COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Al Gore' AND T1.num_pages < 400
| 5,960 | |
books
|
List the author's and publisher's name of the book published on July 10, 1997.
|
author's name refers to author_name; publisher's name refers to publisher_name; book published on July 10, 1997 refers to publication_date LIKE '1997-07-10'
|
SELECT T3.author_name, T4.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T1.publication_date = '1997-07-10'
| 5,961 | |
books
|
What is the language of the book with ISBN 23755004321?
|
"23755004321" is the isbn13; language refers to language_name
|
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.isbn13 = 23755004321
| 5,962 | |
books
|
What is the title of the most expensive book?
|
most expensive book refers to Max(price)
|
SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id ORDER BY T2.price DESC LIMIT 1
| 5,963 | |
books
|
Calculate the total price of books ordered by customer named Lucas Wyldbore.
|
total price refers to Sum(price); full name is composed of first name, last name
|
SELECT SUM(T1.price) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'
| 5,964 | |
books
|
List the ISBN of the book published in Spanish.
|
"Spanish" is the language_name; ISBN refers to isbn13
|
SELECT T1.isbn13 FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'Spanish'
| 5,965 | |
books
|
Among the books that cost less than 1 dollar, how many were published by Berkley Trade?
|
book cost less than 1 dollar refers to price < 1; 'Berkley Trade' is the publisher_name;
|
SELECT COUNT(*) FROM publisher AS T1 INNER JOIN book AS T2 ON T1.publisher_id = T2.publisher_id INNER JOIN order_line AS T3 ON T3.book_id = T2.book_id WHERE T1.publisher_name = 'Berkley' AND T3.price < 1
| 5,966 | |
books
|
List the title of the books purchased by the customer named Zia Roizin.
|
SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Zia' AND T4.last_name = 'Roizin'
| 5,967 | ||
books
|
Who authored the book with greatest number of pages?
|
greatest number of pages refers to Max(num_pages); who authored refers to author_name
|
SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id ORDER BY T1.num_pages DESC LIMIT 1
| 5,968 | |
books
|
List the email of customers that bought the book titled Switch on the Night.
|
"Switch on the Night" is the title
|
SELECT T4.email FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.title = 'Switch on the Night'
| 5,969 | |
books
|
List the author's name of the books published by Abrams.
|
"Abrams" is the publisher_name; author's name refers to author_name
|
SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T4.publisher_name = 'Abrams'
| 5,970 | |
books
|
What is the publisher name of the book titled The Illuminati?
|
"The Illuminati" is the title of book
|
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'The Illuminati'
| 5,971 | |
books
|
In books authored by Abraham Lincoln, what is the percentage of the books published in 1992?
|
"Abraham Lincoln" is the author_name; published in 1992 refers to publication_date LIKE '1992%'; percentage = Divide (Sum(publication_date LIKE '1992%'), Count(publication_date)) * 100
|
SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', T1.publication_date) = '1992' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Abraham Lincoln'
| 5,972 | |
books
|
Among the books published in 2004, list the name of the publisher of books with number of pages greater than 70% of the average number of pages of all books.
|
published in 2004 refers to publication_date LIKE '2004%'; books with number of pages greater than 70% of the average number of pages refers to num_pages > Multiply(Avg(num_pages), 0.7); name of publisher refers to publisher_name
|
SELECT T1.title, T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE STRFTIME('%Y', T1.publication_date) = '2004' AND T1.num_pages * 100 > ( SELECT AVG(num_pages) FROM book ) * 70
| 5,973 | |
books
|
Provide the contact email of Moss Zarb.
|
SELECT email FROM customer WHERE first_name = 'Moss' AND last_name = 'Zarb'
| 5,974 | ||
books
|
Name the streets in Dallas.
|
"Dallas" is the city; streets refers to street_name
|
SELECT street_name FROM address WHERE city = 'Dallas'
| 5,975 | |
books
|
Which books were released by Orson Scott Card in 2001?
|
"Orson Scott Card" is the author_name; released in 2001 refers to publication_date LIKE '2001%'; books refers to title
|
SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Orson Scott Card' AND STRFTIME('%Y', T1.publication_date) = '2001'
| 5,976 | |
books
|
Count the number of books written by Orson Scott Card.
|
"Orson Scott Card" is the author_name
|
SELECT COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Orson Scott Card'
| 5,977 | |
books
|
Provide the authors and titles of the books which have more than 3000 pages.
|
authors refers to author_name; more than 3000 pages refers to num_pages > 3000
|
SELECT T3.author_name, T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T1.num_pages > 3000
| 5,978 | |
books
|
Who wrote "The Prophet"?
|
"The Prophet" is the title of the book: who wrote refers to author_name
|
SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T1.title = 'The Prophet'
| 5,979 | |
books
|
How many books were published by Ace Hardcover?
|
"Ace Hardcover" is the publisher_name
|
SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Ace Hardcover'
| 5,980 | |
books
|
Which publisher published Barry Eisler's book?
|
"Barry Eisler" is the author_name; publisher refers to publisher_name
|
SELECT T4.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'Barry Eisler'
| 5,981 | |
books
|
How many books were published in Japanese?
|
published in Japanese refers to language_name = 'Japanese'
|
SELECT COUNT(T2.book_id) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id WHERE T1.language_name = 'Japanese'
| 5,982 | |
books
|
Sum the total price of the orders for The Prophet book.
|
"The Prophet" is the title of the book: total price refers to Sum(price)
|
SELECT SUM(T1.price) FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id WHERE T2.title = 'The Prophet'
| 5,983 | |
books
|
Provide the number of orders by Daisey Lamball in 2021.
|
in 2021 refers to order_date LIKE '2021%'
|
SELECT COUNT(*) FROM cust_order AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Daisey' AND T2.last_name = 'Lamball' AND STRFTIME('%Y', T1.order_date) = '2021'
| 5,984 | |
books
|
How many customers are from Australia?
|
"Australia" is the country_name;
|
SELECT COUNT(*) FROM customer_address AS T1 INNER JOIN address AS T2 ON T2.address_id = T1.address_id INNER JOIN country AS T3 ON T3.country_id = T2.country_id WHERE T3.country_name = 'Australia'
| 5,985 | |
books
|
How many orders were delivered in December 2019?
|
delivered refers to status_value = 'Delivered'; in December 2019 refers to status_date LIKE '2019-12%'
|
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Delivered' AND STRFTIME('%Y', T2.status_date) = '2019'
| 5,986 | |
books
|
Provide the customers' names who ordered the Fantasmas.
|
"Fantasmas" is the title of the book; customer names refers to first_name, last_name
|
SELECT T4.first_name, T4.last_name FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.title = 'Fantasmas'
| 5,987 | |
books
|
How many percent of orders in 2020 used international shipping?
|
international shipping refers to method_name = 'International'; orders in 2020 refers to order_date = '2020%'; percentage = Divide (Sum(method_name = 'International'), Count(order_id)) * 100
|
SELECT CAST(SUM(CASE WHEN T2.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM cust_order AS T1 INNER JOIN shipping_method AS T2 ON T1.shipping_method_id = T2.method_id WHERE STRFTIME('%Y', T1.order_date) = '2020'
| 5,988 | |
books
|
List all the authors named "George".
|
author named 'George' refers to author_name = 'George%'
|
SELECT author_name FROM author WHERE author_name LIKE 'George%'
| 5,989 | |
books
|
Which year has the most customer orders?
|
year with the most customer orders refers to Max(count(order_id))
|
SELECT strftime('%Y', order_date) FROM cust_order GROUP BY strftime('%Y', order_date) ORDER BY COUNT(strftime('%Y', order_date)) DESC LIMIT 1
| 5,990 | |
books
|
What is the average price for the order line?
|
average price refers to AVG(price)
|
SELECT AVG(price) FROM order_line
| 5,991 | |
books
|
List all of the books that were published in 1995.
|
published in 1995 refers to publication_date LIKE '1995%'; ; list of book refers to title
|
SELECT title FROM book WHERE STRFTIME('%Y', publication_date) = '1995'
| 5,992 | |
books
|
What is the most common domain for the email address among all the customers?
|
most common domain for the email refers to Max(Count(SUBSTR(email, CHARINDEX('@', email) + 1, length(email) - charindex('@', email))))
|
SELECT SUBSTR(email, INSTR(email, '@') + 1, LENGTH(email) - INSTR(email, '@')) AS ym FROM customer GROUP BY SUBSTR(email, INSTR(email, '@') + 1, LENGTH(email) - INSTR(email, '@')) ORDER BY COUNT(*) DESC LIMIT 1
| 5,993 | |
books
|
How many publishers have the word "book" in their name?
|
publisher have the word 'book' refers to publisher_name LIKE '%book%'
|
SELECT COUNT(*) FROM publisher WHERE publisher_name LIKE '%book%'
| 5,994 | |
books
|
Which language is the rarest among all the books?
|
language written in refers to language_name; rarest refers to Min(Count(book_id))
|
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id GROUP BY T2.language_name ORDER BY COUNT(T2.language_name) ASC LIMIT 1
| 5,995 | |
books
|
List all the order dates for the customer named "Adrian Kunzelmann".
|
SELECT T3.order_date FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Adrian' AND T4.last_name = 'Kunzelmann'
| 5,996 | ||
books
|
How many addresses are from the Philippines?
|
"Philippines" is the country_name
|
SELECT COUNT(T2.country_id) FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Philippines'
| 5,997 | |
books
|
Who is the author who wrote the most books?
|
author refers to author_name; who wrote the most book refers to Max(Count(author_id))
|
SELECT T1.author_name FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_name ORDER BY COUNT(T2.author_id) DESC LIMIT 1
| 5,998 | |
books
|
What are the books published by "Harper Collins"?
|
"Harper Collins" is the publisher_name; books refers to title
|
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Harper Collins'
| 5,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.