db_id
stringclasses 69
values | question
stringlengths 24
325
| evidence
stringlengths 1
673
⌀ | SQL
stringlengths 23
804
| schema
stringclasses 69
values |
|---|---|---|---|---|
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'
|
database name:db_id airline
Air Carriers table Air Carriers Cols: Code dtype integer, Description dtype text,
Airports table Airports Cols: Code dtype text, Description dtype text,
Airlines table Airlines Cols: flight date dtype text, operator carrier airline id dtype integer, tail number dtype text, operator carrier flight number dtype integer, origin airport id dtype integer, origin airport sequence id dtype integer, origin city market id dtype integer, ORIGIN dtype text, destination airport id dtype integer, destination airport sequence id dtype integer, destination city market id dtype integer, destination dtype text, scheduled local departure time dtype integer, departure time dtype integer, Departure delay dtype integer, departure delay new dtype integer, arrival time dtype integer, arrival delay dtype integer, arrival delay new dtype integer, CANCELLED dtype integer, cancellation code dtype text, scheduled elapsed time dtype integer, actual elapsed time dtype integer, carrier delay dtype integer, weather delay dtype integer, National Aviavtion System delay dtype integer, security delay dtype integer, late aircraft delay dtype integer,
|
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'
|
database name:db_id airline
Air Carriers table Air Carriers Cols: Code dtype integer, Description dtype text,
Airports table Airports Cols: Code dtype text, Description dtype text,
Airlines table Airlines Cols: flight date dtype text, operator carrier airline id dtype integer, tail number dtype text, operator carrier flight number dtype integer, origin airport id dtype integer, origin airport sequence id dtype integer, origin city market id dtype integer, ORIGIN dtype text, destination airport id dtype integer, destination airport sequence id dtype integer, destination city market id dtype integer, destination dtype text, scheduled local departure time dtype integer, departure time dtype integer, Departure delay dtype integer, departure delay new dtype integer, arrival time dtype integer, arrival delay dtype integer, arrival delay new dtype integer, CANCELLED dtype integer, cancellation code dtype text, scheduled elapsed time dtype integer, actual elapsed time dtype integer, carrier delay dtype integer, weather delay dtype integer, National Aviavtion System delay dtype integer, security delay dtype integer, late aircraft delay dtype integer,
|
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'
|
database name:db_id airline
Air Carriers table Air Carriers Cols: Code dtype integer, Description dtype text,
Airports table Airports Cols: Code dtype text, Description dtype text,
Airlines table Airlines Cols: flight date dtype text, operator carrier airline id dtype integer, tail number dtype text, operator carrier flight number dtype integer, origin airport id dtype integer, origin airport sequence id dtype integer, origin city market id dtype integer, ORIGIN dtype text, destination airport id dtype integer, destination airport sequence id dtype integer, destination city market id dtype integer, destination dtype text, scheduled local departure time dtype integer, departure time dtype integer, Departure delay dtype integer, departure delay new dtype integer, arrival time dtype integer, arrival delay dtype integer, arrival delay new dtype integer, CANCELLED dtype integer, cancellation code dtype text, scheduled elapsed time dtype integer, actual elapsed time dtype integer, carrier delay dtype integer, weather delay dtype integer, National Aviavtion System delay dtype integer, security delay dtype integer, late aircraft delay dtype integer,
|
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'
|
database name:db_id airline
Air Carriers table Air Carriers Cols: Code dtype integer, Description dtype text,
Airports table Airports Cols: Code dtype text, Description dtype text,
Airlines table Airlines Cols: flight date dtype text, operator carrier airline id dtype integer, tail number dtype text, operator carrier flight number dtype integer, origin airport id dtype integer, origin airport sequence id dtype integer, origin city market id dtype integer, ORIGIN dtype text, destination airport id dtype integer, destination airport sequence id dtype integer, destination city market id dtype integer, destination dtype text, scheduled local departure time dtype integer, departure time dtype integer, Departure delay dtype integer, departure delay new dtype integer, arrival time dtype integer, arrival delay dtype integer, arrival delay new dtype integer, CANCELLED dtype integer, cancellation code dtype text, scheduled elapsed time dtype integer, actual elapsed time dtype integer, carrier delay dtype integer, weather delay dtype integer, National Aviavtion System delay dtype integer, security delay dtype integer, late aircraft delay dtype integer,
|
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'
|
database name:db_id airline
Air Carriers table Air Carriers Cols: Code dtype integer, Description dtype text,
Airports table Airports Cols: Code dtype text, Description dtype text,
Airlines table Airlines Cols: flight date dtype text, operator carrier airline id dtype integer, tail number dtype text, operator carrier flight number dtype integer, origin airport id dtype integer, origin airport sequence id dtype integer, origin city market id dtype integer, ORIGIN dtype text, destination airport id dtype integer, destination airport sequence id dtype integer, destination city market id dtype integer, destination dtype text, scheduled local departure time dtype integer, departure time dtype integer, Departure delay dtype integer, departure delay new dtype integer, arrival time dtype integer, arrival delay dtype integer, arrival delay new dtype integer, CANCELLED dtype integer, cancellation code dtype text, scheduled elapsed time dtype integer, actual elapsed time dtype integer, carrier delay dtype integer, weather delay dtype integer, National Aviavtion System delay dtype integer, security delay dtype integer, late aircraft delay dtype integer,
|
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
|
database name:db_id airline
Air Carriers table Air Carriers Cols: Code dtype integer, Description dtype text,
Airports table Airports Cols: Code dtype text, Description dtype text,
Airlines table Airlines Cols: flight date dtype text, operator carrier airline id dtype integer, tail number dtype text, operator carrier flight number dtype integer, origin airport id dtype integer, origin airport sequence id dtype integer, origin city market id dtype integer, ORIGIN dtype text, destination airport id dtype integer, destination airport sequence id dtype integer, destination city market id dtype integer, destination dtype text, scheduled local departure time dtype integer, departure time dtype integer, Departure delay dtype integer, departure delay new dtype integer, arrival time dtype integer, arrival delay dtype integer, arrival delay new dtype integer, CANCELLED dtype integer, cancellation code dtype text, scheduled elapsed time dtype integer, actual elapsed time dtype integer, carrier delay dtype integer, weather delay dtype integer, National Aviavtion System delay dtype integer, security delay dtype integer, late aircraft delay dtype integer,
|
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
|
database name:db_id airline
Air Carriers table Air Carriers Cols: Code dtype integer, Description dtype text,
Airports table Airports Cols: Code dtype text, Description dtype text,
Airlines table Airlines Cols: flight date dtype text, operator carrier airline id dtype integer, tail number dtype text, operator carrier flight number dtype integer, origin airport id dtype integer, origin airport sequence id dtype integer, origin city market id dtype integer, ORIGIN dtype text, destination airport id dtype integer, destination airport sequence id dtype integer, destination city market id dtype integer, destination dtype text, scheduled local departure time dtype integer, departure time dtype integer, Departure delay dtype integer, departure delay new dtype integer, arrival time dtype integer, arrival delay dtype integer, arrival delay new dtype integer, CANCELLED dtype integer, cancellation code dtype text, scheduled elapsed time dtype integer, actual elapsed time dtype integer, carrier delay dtype integer, weather delay dtype integer, National Aviavtion System delay dtype integer, security delay dtype integer, late aircraft delay dtype integer,
|
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
|
database name:db_id airline
Air Carriers table Air Carriers Cols: Code dtype integer, Description dtype text,
Airports table Airports Cols: Code dtype text, Description dtype text,
Airlines table Airlines Cols: flight date dtype text, operator carrier airline id dtype integer, tail number dtype text, operator carrier flight number dtype integer, origin airport id dtype integer, origin airport sequence id dtype integer, origin city market id dtype integer, ORIGIN dtype text, destination airport id dtype integer, destination airport sequence id dtype integer, destination city market id dtype integer, destination dtype text, scheduled local departure time dtype integer, departure time dtype integer, Departure delay dtype integer, departure delay new dtype integer, arrival time dtype integer, arrival delay dtype integer, arrival delay new dtype integer, CANCELLED dtype integer, cancellation code dtype text, scheduled elapsed time dtype integer, actual elapsed time dtype integer, carrier delay dtype integer, weather delay dtype integer, National Aviavtion System delay dtype integer, security delay dtype integer, late aircraft delay dtype integer,
|
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
|
database name:db_id airline
Air Carriers table Air Carriers Cols: Code dtype integer, Description dtype text,
Airports table Airports Cols: Code dtype text, Description dtype text,
Airlines table Airlines Cols: flight date dtype text, operator carrier airline id dtype integer, tail number dtype text, operator carrier flight number dtype integer, origin airport id dtype integer, origin airport sequence id dtype integer, origin city market id dtype integer, ORIGIN dtype text, destination airport id dtype integer, destination airport sequence id dtype integer, destination city market id dtype integer, destination dtype text, scheduled local departure time dtype integer, departure time dtype integer, Departure delay dtype integer, departure delay new dtype integer, arrival time dtype integer, arrival delay dtype integer, arrival delay new dtype integer, CANCELLED dtype integer, cancellation code dtype text, scheduled elapsed time dtype integer, actual elapsed time dtype integer, carrier delay dtype integer, weather delay dtype integer, National Aviavtion System delay dtype integer, security delay dtype integer, late aircraft delay dtype integer,
|
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 )
|
database name:db_id airline
Air Carriers table Air Carriers Cols: Code dtype integer, Description dtype text,
Airports table Airports Cols: Code dtype text, Description dtype text,
Airlines table Airlines Cols: flight date dtype text, operator carrier airline id dtype integer, tail number dtype text, operator carrier flight number dtype integer, origin airport id dtype integer, origin airport sequence id dtype integer, origin city market id dtype integer, ORIGIN dtype text, destination airport id dtype integer, destination airport sequence id dtype integer, destination city market id dtype integer, destination dtype text, scheduled local departure time dtype integer, departure time dtype integer, Departure delay dtype integer, departure delay new dtype integer, arrival time dtype integer, arrival delay dtype integer, arrival delay new dtype integer, CANCELLED dtype integer, cancellation code dtype text, scheduled elapsed time dtype integer, actual elapsed time dtype integer, carrier delay dtype integer, weather delay dtype integer, National Aviavtion System delay dtype integer, security delay dtype integer, late aircraft delay dtype integer,
|
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
|
database name:db_id airline
Air Carriers table Air Carriers Cols: Code dtype integer, Description dtype text,
Airports table Airports Cols: Code dtype text, Description dtype text,
Airlines table Airlines Cols: flight date dtype text, operator carrier airline id dtype integer, tail number dtype text, operator carrier flight number dtype integer, origin airport id dtype integer, origin airport sequence id dtype integer, origin city market id dtype integer, ORIGIN dtype text, destination airport id dtype integer, destination airport sequence id dtype integer, destination city market id dtype integer, destination dtype text, scheduled local departure time dtype integer, departure time dtype integer, Departure delay dtype integer, departure delay new dtype integer, arrival time dtype integer, arrival delay dtype integer, arrival delay new dtype integer, CANCELLED dtype integer, cancellation code dtype text, scheduled elapsed time dtype integer, actual elapsed time dtype integer, carrier delay dtype integer, weather delay dtype integer, National Aviavtion System delay dtype integer, security delay dtype integer, late aircraft delay dtype integer,
|
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%'
|
database name:db_id airline
Air Carriers table Air Carriers Cols: Code dtype integer, Description dtype text,
Airports table Airports Cols: Code dtype text, Description dtype text,
Airlines table Airlines Cols: flight date dtype text, operator carrier airline id dtype integer, tail number dtype text, operator carrier flight number dtype integer, origin airport id dtype integer, origin airport sequence id dtype integer, origin city market id dtype integer, ORIGIN dtype text, destination airport id dtype integer, destination airport sequence id dtype integer, destination city market id dtype integer, destination dtype text, scheduled local departure time dtype integer, departure time dtype integer, Departure delay dtype integer, departure delay new dtype integer, arrival time dtype integer, arrival delay dtype integer, arrival delay new dtype integer, CANCELLED dtype integer, cancellation code dtype text, scheduled elapsed time dtype integer, actual elapsed time dtype integer, carrier delay dtype integer, weather delay dtype integer, National Aviavtion System delay dtype integer, security delay dtype integer, late aircraft delay dtype integer,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
books
|
Please list the titles of all the books that Lucas Wyldbore has ordered.
| null |
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
books
|
Which city does the address id 547 belong to?
| null |
SELECT city FROM address WHERE address_id = 547
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
books
|
How many orders has Cordy Dumbarton made?
| null |
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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á'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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%'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
books
|
List the title of the books purchased by the customer named Zia Roizin.
| null |
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
books
|
Provide the contact email of Moss Zarb.
| null |
SELECT email FROM customer WHERE first_name = 'Moss' AND last_name = 'Zarb'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
books
|
Name the streets in Dallas.
|
"Dallas" is the city; streets refers to street_name
|
SELECT street_name FROM address WHERE city = 'Dallas'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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%'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
books
|
What is the average price for the order line?
|
average price refers to AVG(price)
|
SELECT AVG(price) FROM order_line
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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%'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
books
|
List all the order dates for the customer named "Adrian Kunzelmann".
| null |
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
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'
|
database name:db_id books
address_status table address_status Cols: status id dtype integer, address status dtype text,
author table author Cols: author id dtype integer, author name dtype text,
book_language table book_language Cols: language id dtype integer, language code dtype text, language name dtype text,
country table country Cols: country id dtype integer, country name dtype text,
address table address Cols: address id dtype integer, street number dtype text, street name dtype text, city dtype text, country id dtype integer,
customer table customer Cols: customer id dtype integer, first name dtype text, last name dtype text, email dtype text,
customer_address table customer_address Cols: customer id dtype integer, address id dtype integer, status id dtype integer,
order_status table order_status Cols: status id dtype integer, status value dtype text,
publisher table publisher Cols: publisher id dtype integer, publisher name dtype text,
book table book Cols: book id dtype integer, title dtype text, isbn13 dtype text, language id dtype integer, number pages dtype integer, publication date dtype date, publisher_id dtype integer,
book_author table book_author Cols: book id dtype integer, author id dtype integer,
shipping_method table shipping_method Cols: method id dtype integer, method name dtype text, cost dtype real,
cust_order table cust_order Cols: order id dtype integer, order date dtype datetime, customer id dtype integer, shipping method id dtype integer, destination address id dtype integer,
order_history table order_history Cols: history id dtype integer, order_id dtype integer, status id dtype integer, status date dtype datetime,
order_line table order_line Cols: line id dtype integer, order id dtype integer, book id dtype integer, price dtype real,
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.