db_id stringclasses 68 values | question stringlengths 24 325 | evidence stringlengths 0 580 | SQL stringlengths 23 728 |
|---|---|---|---|
airline | Provide the number of airplanes that landed on Oakland Airport on 2018/8/7. | landed on refers to DEST; Oakland Airport refers to Description which contains 'Oakland'; on 2018/8/7 refers to FL_DATE = '2018/8/7'; | SELECT SUM(CASE WHEN T1.Description LIKE '%Oakland%' THEN 1 ELSE 0 END) AS count FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/7' |
airline | Tell the number of fights landed earlier on Miami Airport on 2018/8/12. | landed on refers to DEST; landed earlier refers to ARR_DELAY < 0; Miami Airport refers to DEST = 'MIA'; on 2018/8/12 refers to FL_DATE = '2018/8/12'; | SELECT COUNT(*) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/12' AND T2.DEST = 'MIA' AND T2.ARR_DELAY < 0 |
airline | Provide the name of the airport which landed the most number of flights on 2018/8/15. | name of the airport refers to Description; airport that landed the most number of flights refers to MAX(COUNT(DEST)); on 2018/8/15 refers to FL_DATE = '2018/8/15'; | SELECT T1.Description FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/15' ORDER BY T2.DEST DESC LIMIT 1 |
airline | Tell the number of flights that landed at Lake Charles Regional Airport on 2018/8/15. | landed at refers to DEST; Lake Charles Regional Airport refers to Description = 'Lake Charles, LA: Lake Charles Regional'; on 2018/8/15 refers to FL_DATE = '2018/8/15'; | SELECT COUNT(T1.Code) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE = '2018/8/15' AND T1.Description = 'Lake Charles, LA: Lake Charles Regional' |
airline | What is the percentage of flights from Los Angeles International airport that were cancelled due to a type C cancellation code? | percentage = MULTIPLY(DIVIDE(SUM(CANCELLATION_CODE = 'C'), COUNT(Code)), 100); flights from refers to ORIGIN; Los Angeles International airport refers to Description = 'Los Angeles, CA: Los Angeles International'; cancelled refers to Cancelled = 1; cancelled due to a type C cancellation code refers to CANCELLATION_CODE = 'C'; | SELECT CAST(SUM(CASE WHEN T2.CANCELLATION_CODE = 'C' THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE = '2018/8/15' AND T2.CANCELLATION_CODE IS NOT NULL AND T1.Description = 'Los Angeles, CA: Los Angeles International' |
airline | What is the percentage of flights which landed at Pittsburgh were faster than scheduled? | percentage = MULTIPLY(DIVIDE(SUM(ACTUAL_ELAPSED_TIME < T2.CRS_ELAPSED_TIME), COUNT(Code)), 100); landed at refers to DEST; Pittsburgh refers to Description which contains 'Pittsburgh'; faster than scheduled refers to ACTUAL_ELAPSED_TIME < CRS_ELAPSED_TIME; | SELECT CAST(SUM(CASE WHEN T1.ACTUAL_ELAPSED_TIME < T1.CRS_ELAPSED_TIME THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T2.Code = T1.DEST WHERE T2.Description LIKE '%Pittsburgh%' AND T1.CRS_ELAPSED_TIME IS NOT NULL AND T1.ACTUAL_ELAPSED_TIME IS NOT NULL |
airline | How many flights departed on time on 8/1/2018? | departed on time refers to DEP_DELAY < = 0; on 8/1/2018 refers to FL_DATE = '2018/8/1'; | SELECT COUNT(*) FROM Airlines WHERE FL_DATE = '2018/8/1' AND DEP_DELAY <= 0 |
airline | What are the codes of the airport found in Ankara, Turkey? | airport found in Ankara, Turkey refers to Description like '%Ankara, Turkey%'; | SELECT Code FROM Airports WHERE Description LIKE '%Ankara, Turkey%' |
airline | What is the IATA code of the Anita Bay Airport in Anita Bay, Alaska? | IATA code refers to Code; Anita Bay Airport in Anita Bay, Alaska refers to Description = 'Anita Bay, AK: Anita Bay Airport'; | SELECT Code FROM Airports WHERE Description = 'Anita Bay, AK: Anita Bay Airport' |
airline | What is the origin airport id that recorded the longest delay due to a late aircraft? | origin airport id refers to ORIGIN_AIRPORT_ID; longest delay due to a late aircraft refers to MAX(LATE_AIRCRAFT_DELAY); | SELECT ORIGIN_AIRPORT_ID FROM Airlines ORDER BY LATE_AIRCRAFT_DELAY DESC LIMIT 1 |
airline | On August 2018, which day had the highest number of cancelled flights due to the most serious reasons in Dallas/Fort Worth International? | On August 2018 refers to FL_DATE like '2018/8%'; day with the highest number of cancelled flights refers to MAX(COUNT(FL_DATE WHERE CANCELLED = 1)); cancelled due to the most serious reasons refers to CANCELLATION_CODE = 'A'; in Dallas/Fort Worth International refers to Description = 'Dallas/Fort Worth, TX: Dallas/Fort Worth International'; | SELECT T2.FL_DATE FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.ORIGIN WHERE T2.FL_DATE LIKE '2018/8%' AND T1.Description = 'Dallas/Fort Worth, TX: Dallas/Fort Worth International' AND T2.ORIGIN = 'DFW' AND T2.CANCELLED = 1 AND T2.CANCELLATION_CODE = 'A' GROUP BY T2.FL_DATE ORDER BY COUNT(T2.FL_DATE) DESC LIMIT 1 |
airline | List the tail numbers of all the aircraft that arrived on time at Meadows Field airport in August of 2018? | tail number refers to TAIL_NUM; arrived on time refers to ARR_DELAY < = 0; Meadows Field airport refers to Description = 'Bakersfield, CA: Meadows Field'; in August of 2018 refers to FL_DATE like '2018/8%'; | SELECT T2.TAIL_NUM FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T2.FL_DATE LIKE '2018/8%' AND T1.Description = 'Bakersfield, CA: Meadows Field' AND T2.DEST = 'BFL' AND T2.ARR_DELAY <= 0 GROUP BY T2.TAIL_NUM |
airline | Among the airports whose destination is Logan International, what is the airline id of the carrier operator with the highest delay in minutes due to security? | destination refers to DEST; Logan International refers to Description = 'Boston, MA: Logan International'; airline id of the carrier operator refers to OP_CARRIER_AIRLINE_ID; highest delay in minutes due to security refers to MAX(SECURITY_DELAY); | SELECT T2.OP_CARRIER_AIRLINE_ID FROM Airports AS T1 INNER JOIN Airlines AS T2 ON T1.Code = T2.DEST WHERE T1.Description = 'Boston, MA: Logan International' AND T2.DEST = 'BOS' ORDER BY T2.SECURITY_DELAY DESC LIMIT 1 |
airline | Which airline does the aircraft with the fastest flight belong to? | fastest flight refers to MIN(SUBTRACT(ACTUAL_ELAPSED_TIME, CRS_ELAPSED_TIME)); | SELECT T1.OP_CARRIER_AIRLINE_ID FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T1.ORIGIN = T2.Code WHERE T1.ACTUAL_ELAPSED_TIME IS NOT NULL AND T1.CRS_ELAPSED_TIME IS NOT NULL ORDER BY T1.ACTUAL_ELAPSED_TIME - T1.CRS_ELAPSED_TIME ASC LIMIT 1 |
airline | Please list any three airports with their codes. | SELECT Code, Description FROM Airports LIMIT 3 | |
airline | What is the scheduled local departure time and the actual departure time of the flight from Philadelphia to Harrisburg with the plane's tail number N627AE on the 13th of August 2018? | scheduled local departure time refers to CRS_DEP_TIME; actual departure time refers to DEP_TIME; from Philadelphia refers to ORIGIN = 'PHL'; to Harrisburg refers to DEST = 'MDT'; tail number refers to TAIL_NUM; TAIL_NUM = 'N627AE'; on the 13th of August 2018 refers to FL_DATE = '2018/8/13'; | SELECT CRS_DEP_TIME, DEP_TIME FROM Airlines WHERE ORIGIN = 'PHL' AND DEST = 'MDT' AND TAIL_NUM = 'N627AE' AND FL_DATE = '2018/8/13' |
airline | How many flights on the 1st of August 2018 were coming from Allentown, Pennsylvania? | 1st of August 2018 refers to FL_DATE = '2018/8/1'; coming from Allentown, Pennsylvania refers to ORIGIN = 'ABE'; | SELECT COUNT(*) FROM Airlines WHERE FL_DATE = '2018/8/1' AND ORIGIN = 'ABE' |
airline | What is the only flight destination for flights from Albany? | flight destination refers to DEST; from Albany refers to ORIGIN = 'ABY'; | SELECT DEST FROM Airlines WHERE ORIGIN = 'ABY' GROUP BY DEST |
airline | How many flights from Dallas to Santa Ana departed on time? | from Dallas refers to ORIGIN = 'DFW'; to Santa Ana refers to DEST = 'SNA'; departed on time refers to DEP_DELAY = 0; | SELECT COUNT(*) FROM Airlines WHERE DEST = 'SNA' AND ORIGIN = 'DFW' AND DEP_DELAY = 0 |
airline | How many flights from Charlotte Douglas International Airport to Austin - Bergstrom International Airport experienced serious reasons that cause flight cancellation? | from refers to ORIGIN; Charlotte Douglas International Airport refers to Description = 'Charlotte, NC: Charlotte Douglas International'; to refers to DEST; Austin - Bergstrom International Airport refers to Description = 'Austin, TX: Austin - Bergstrom International'; serious reasons refers to CANCELLATION_CODE = 'A'; | SELECT COUNT(*) FROM Airlines AS T1 INNER JOIN Airports AS T2 ON T1.ORIGIN = T2.Code WHERE T1.ORIGIN = 'CLT' AND T1.DEST = 'AUS' AND T2.Description = 'Charlotte, NC: Charlotte Douglas International' AND T1.CANCELLATION_CODE = 'A' |
airline | What is the airport description of the airport code A11? | SELECT Description FROM Airports WHERE Code = 'A11' | |
airline | What is the total number of flights that have Oklahoma as their origin? | Oklahoma as origin refers to Origin = 'OKC'; | SELECT COUNT(*) AS num FROM Airlines WHERE Origin = 'OKC' |
airline | How many airports have a code starting with the letter C? | code starting with the letter C refers to Code like 'C%'; | SELECT COUNT(*) FROM Airports WHERE Code LIKE 'C%' |
airline | Provide the destinations of flight number 1596. | destination refers to DEST; flight number refers to OP_CARRIER_FL_NUM; OP_CARRIER_FL_NUM = 1596; | SELECT DEST FROM Airlines WHERE OP_CARRIER_FL_NUM = 1596 |
airline | List the description of the airports that have code that ends with number 3? | code that ends with number 3 refers to Code like '%3'; | SELECT Description FROM Airports WHERE Code LIKE '%3' |
airline | Give the code of the airport described as Driftwood Bay, AK: Driftwood Bay Airport. | Driftwood Bay, AK: Driftwood Bay Airport refers to Description = 'Driftwood Bay, AK: Driftwood Bay Airport'; | SELECT Code FROM Airports WHERE Description = 'Driftwood Bay, AK: Driftwood Bay Airport' |
airline | How many cancelled flights are there? | cancelled flights refers to CANCELLED = 1; | SELECT COUNT(*) FROM Airlines WHERE CANCELLED = 1 |
airline | List the tail number of flights that flew on August 17, 2018. | tail number refers to TAIL_NUM; on August 17, 2018 refers to FL_DATE = '2018/8/17'; | SELECT TAIL_NUM FROM Airlines WHERE FL_DATE = '2018/8/17' GROUP BY TAIL_NUM |
airline | Provide the origin of the flight that has the shortest actual elapsed time. | shortest actual elapsed time refers to MIN(ACTUAL_ELAPSED_TIME); | SELECT ORIGIN FROM Airlines ORDER BY ACTUAL_ELAPSED_TIME ASC LIMIT 1 |
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 |
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 |
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' |
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' |
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 |
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 |
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 |
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 |
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' |
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' |
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' |
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' | |
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 |
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' |
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' |
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' |
books | Which city does the address id 547 belong to? | SELECT city FROM address WHERE address_id = 547 | |
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' | |
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 |
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 |
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' |
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 |
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 |
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 |
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' |
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á' |
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 |
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' |
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' |
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' |
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 |
books | What is the full name of the customer who owns the "aalleburtonkc@yellowbook.com" e-mail address? | "aalleburtonkc@yellowbook.com" is the email of customer; full name refers to first_name, last_name | SELECT first_name, last_name FROM customer WHERE email = 'aalleburtonkc@yellowbook.com' |
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' |
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 |
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' |
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 |
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 |
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' |
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 |
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' |
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' |
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 |
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 |
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 |
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' |
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 |
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' |
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' |
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 |
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' | |
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 |
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' |
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' |
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' |
books | Provide the contact email of Moss Zarb. | SELECT email FROM customer WHERE first_name = 'Moss' AND last_name = 'Zarb' | |
books | Name the streets in Dallas. | "Dallas" is the city; streets refers to street_name | SELECT street_name FROM address WHERE city = 'Dallas' |
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' |
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 |
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' |
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' |
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' |
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' |
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' |
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' |
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' |
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%' |
books | What is the average price for the order line? | average price refers to AVG(price) | SELECT AVG(price) FROM order_line |
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%' |
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 |
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' | |
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' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.