input
stringlengths
236
16.9k
output
stringlengths
19
805
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many orders were returned in the year 2020?
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Returned' AND STRFTIME('%Y', T2.status_date) = '2020';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the second-least common method of shipping?
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) ASC LIMIT 1, 1;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many of the customer addresses are inactive?
SELECT COUNT(*) FROM customer_address AS T1 INNER JOIN address_status AS T2 ON T1.status_id = T2.status_id WHERE T2.address_status = 'Inactive';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the book with the most orders?
SELECT T2.title FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id GROUP BY T2.title ORDER BY COUNT(T1.book_id) DESC LIMIT 1;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the address that received the most orders?
SELECT T2.street_name, T2.city FROM cust_order AS T1 INNER JOIN address AS T2 ON T1.dest_address_id = T2.address_id GROUP BY T2.street_number, T2.street_name, T2.city ORDER BY COUNT(T1.dest_address_id) DESC LIMIT 1;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How much time does it take to update the status of order "2398"?
SELECT strftime('%J', T2.status_date) - strftime('%J', T1.order_date) FROM cust_order AS T1 INNER JOIN order_history AS T2 ON T1.order_id = T2.order_id WHERE T1.order_id = 2398;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Which customer has the most addresses?
SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(T2.customer_id) DESC LIMIT 1;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What percentage of the total prices of all orders are shipped internationally?
SELECT CAST(SUM(CASE WHEN T3.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM cust_order AS T1 INNER JOIN order_line AS T2 ON T1.order_id = T2.order_id INNER JOIN shipping_method AS T3 ON T3.method_id = T1.shipping_method_id;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- List all the authors who wrote fewer pages than the average.
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.num_pages < ( SELECT AVG(num_pages) FROM book );
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Other than zero, what is the lowest price paid by a customer for an order?
SELECT MIN(price) FROM order_line WHERE price <> 0;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many customers have an address that is located in the city of Villeneuve-la-Garenne?
SELECT COUNT(address_id) FROM address WHERE city = 'Villeneuve-la-Garenne';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many authors are named Adam?
SELECT COUNT(*) FROM author WHERE author_name LIKE 'Adam%';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many customers use a Yahoo! Mail e-mail address?
SELECT COUNT(*) FROM customer WHERE email LIKE '%@yahoo.com';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What are the city addresses of the customers located in the United States of America?
SELECT DISTINCT T2.city FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id WHERE T1.country_name = 'United States of America';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many orders did Marcelia Goering place in 2021 that uses the Priority Shipping method?
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 = 'Marcelia' AND T1.last_name = 'Goering' AND STRFTIME('%Y', T2.order_date) = '2021' AND T3.method_name = 'Priority';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Which books have the most expensive price?
SELECT T2.title FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id ORDER BY T1.price DESC LIMIT 1;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many customers ordered the book titled "Anleitung zum Zickigsein"
SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'Anleitung zum Zickigsein';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the most expensive price paid by a customer for the book "Bite Me If You Can (Argeneau #6)"?
SELECT MAX(T2.price) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'Bite Me If You Can (Argeneau #6)';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many customers ordered the oldest book?
SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id GROUP BY T1.publication_date ORDER BY T1.publication_date ASC LIMIT 1;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- List all the titles of the Spanish books published by Alfaguara.
SELECT T2.title FROM book_language AS T1 INNER JOIN book AS T2 ON T2.language_id = T1.language_id INNER JOIN publisher AS T3 ON T3.publisher_id = T2.publisher_id WHERE T1.language_name = 'Spanish' AND T3.publisher_name = 'Alfaguara' GROUP BY T2.title;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many customers ordered Stephen King's first book?
SELECT COUNT(T1.publication_date) 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 order_line AS T4 ON T4.book_id = T1.book_id WHERE T3.author_name = 'Stephen King' ORDER BY T1.publication_date ASC LIMIT 1;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What are the languages of the first two published books?
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id ORDER BY T1.publication_date ASC LIMIT 2;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Who published the book "The Secret Garden"?
SELECT DISTINCT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'The Secret Garden';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Among the books that were published by Scholastic, how many were written by J.K Rowling?
SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id INNER JOIN book_author AS T3 ON T3.book_id = T1.book_id INNER JOIN author AS T4 ON T4.author_id = T3.author_id WHERE T2.publisher_name = 'Scholastic' AND T4.author_name = 'J.K. Rowling';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What are the names of all the publishers who have published at least 30 books?
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 HAVING COUNT(T2.publisher_name) >= 30;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Indicate the last number of each street.
SELECT street_number FROM address;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Indicate the complete address of customers located in Lazaro Cardenas.
SELECT street_number, street_name, city, country_id FROM address WHERE city = 'Lazaro Cardenas';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Indicate the ISBN13 of all the books that have less than 140 pages and more than 135.
SELECT isbn13 FROM book WHERE num_pages < 140 AND num_pages > 135;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Indicate the title of the six books with the greatest potential value as collectibles.
SELECT title FROM book ORDER BY publication_date ASC LIMIT 6;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many books were ordered in the last month of the year 2020?
SELECT COUNT(*) FROM cust_order WHERE order_date LIKE '2020-12%';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Indicate the full name of all customers whose last name begins with the letter K.
SELECT first_name, last_name FROM customer WHERE last_name LIKE 'K%';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- In which cities are the customers of Costa Rica located?
SELECT T1.city FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Costa Rica';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Which customer addresses are no longer active?
SELECT DISTINCT T1.street_name FROM address AS T1 INNER JOIN customer_address AS T2 ON T1.address_id = T2.address_id INNER JOIN address_status AS T3 ON T3.status_id = T2.status_id WHERE T3.address_status = 'Inactive';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the full name of the customers who live in Baiyin city?
SELECT T3.first_name, T3.last_name FROM address AS T1 INNER JOIN customer_address AS T2 ON T1.address_id = T2.address_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T1.city = 'Baiyin';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the email of the customers who place their orders with priority method?
SELECT T1.email 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 T3.method_name = 'Priority';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- On what date did the customers who live at number 460 of their respective streets place their orders?
SELECT T1.order_date FROM cust_order AS T1 INNER JOIN address AS T2 ON T1.dest_address_id = T2.address_id WHERE T2.street_number = 460;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Identify by their id all the orders that have been cancelled.
SELECT T2.order_id FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Cancelled';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the status of the orders placed on 04/10/2022?
SELECT DISTINCT T1.status_value 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 WHERE T3.order_date LIKE '2022-04-10%';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the highest price at which a customer bought the book 'The Prophet'?
SELECT MAX(T2.price) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'The Prophet';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- On what dates were books ordered at a price of 16.54?
SELECT T1.order_date FROM cust_order AS T1 INNER JOIN order_line AS T2 ON T1.order_id = T2.order_id WHERE T2.price = 16.54;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- List the titles of all the books that Peter H. Smith wrote.
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 = 'Peter H. Smith';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many books under 300 pages has HarperCollins Publishers published?
SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'HarperCollins Publishers' AND T1.num_pages < 300;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many books have been published in Japanese?
SELECT COUNT(*) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id WHERE T1.language_name = 'Japanese';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the average number of pages in the books written by Jennifer Crusie?
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 = 'Jennifer Crusie';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What percentage of the orders placed by Kaleena were shipped by the international method?
SELECT CAST(SUM(CASE WHEN T3.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / 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 = 'Kaleena';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Provide the full name of the customers who have ordered the book The Sorrows of Young Werther.
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 = 'The Sorrows of Young Werther';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- List every book that Ursola Purdy has ordered.
SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Ursola' AND T4.last_name = 'Purdy';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Who is the author of the book with the biggest page count?
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 schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many books written by Akira Watanabe are available on Gravity?
SELECT COUNT(*) FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id WHERE T1.author_name = 'Akira Watanabe';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Provide the full address of Ursola Purdy.
SELECT T3.street_number, T3.street_name, T3.city 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 = 'Ursola' AND T1.last_name = 'Purdy';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Who is the author of the book The Mystery in the Rocky Mountains?
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 Mystery in the Rocky Mountains';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Identify the publisher of the book Girls' Night In.
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'Girls'' Night In';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Name the publisher of the oldest book.
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id ORDER BY T1.publication_date ASC LIMIT 1;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Identify the cost difference between Priority and Express shipping methods.
SELECT SUM(CASE WHEN method_name = 'Priority' THEN cost ELSE 0 END) - SUM(CASE WHEN method_name = 'Express' THEN cost ELSE 0 END) FROM shipping_method;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many orders have been cancelled in 2022?
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Cancelled' AND STRFTIME('%Y', T2.status_date) = '2022';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- List all the books published by BBC Audiobooks.
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'BBC Audiobooks';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many books were published in 2017?
SELECT COUNT(*) FROM book WHERE STRFTIME('%Y', publication_date) = '2017';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Provide the International Standard Book Number of the book The Mystery in the Rocky Mountains.
SELECT isbn13 FROM book WHERE title = 'The Mystery in the Rocky Mountains';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Among all orders updated in 2022, identify the percentage that has been returned.
SELECT CAST(SUM(CASE WHEN T1.status_value = 'Returned' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE STRFTIME('%Y', T2.status_date) = '2022';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Among all addresses provided by customers, identify the percentage that are not in use anymore.
SELECT CAST(SUM(CASE WHEN T2.address_status = 'Inactive' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM customer_address AS T1 INNER JOIN address_status AS T2 ON T2.status_id = T1.status_id;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many pages does 'Seaward' have?
SELECT num_pages FROM book WHERE title = 'Seaward';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Who is the author of First Things First?
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 = 'First Things First';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- List all books authored by Tom Clancy.
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 = 'Tom Clancy';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Which book by Hirohiko Araki was published on 6/6/2006?
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 = 'Hirohiko Araki' AND T1.publication_date = '2006-06-06';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Who is the publisher of Hitchhiker's Guide To The Galaxy: The Filming of the Douglas Adams classic?
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'Hitchhiker''s Guide To The Galaxy: The Filming of the Douglas Adams classic';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- List all books published by ADV Manga.
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'ADV Manga';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Write the full name of the customers whose address is at 55 Dorton Pass, Huangqiao.
SELECT DISTINCT T1.first_name, T1.last_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 WHERE T3.street_number = 55 AND T3.street_name = 'Dorton Pass' AND T3.city = 'Huangqiao';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Which country is 9 Green Ridge Point, Arendal located at?
SELECT T2.country_name FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T1.street_number = 9 AND T1.street_name = 'Green Ridge Point' AND T1.city = 'Arendal';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- List 10 addresses located in Poland.
SELECT T1.street_number, T1.street_name, T1.city FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Poland' LIMIT 10;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the shipping method ordered by Nicolette Sadler at 6/29/2020 7:40:07 PM?
SELECT T3.method_name FROM cust_order AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T1.shipping_method_id WHERE T2.first_name = 'Nicolette' AND T2.last_name = 'Sadler' AND T1.order_date = '2020-06-29 19:40:07';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- List all books written in Arabic.
SELECT T1.title FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'Arabic';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Which language is 'El plan infinito' written in?
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'El plan infinito';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What percentage of books written by Hirohiko make up the number of books published by Viz Media?
SELECT CAST(SUM(CASE WHEN T1.author_name = 'Hirohiko Araki' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM author AS T1 INNER JOIN book_author AS T2 ON T2.author_id = T1.author_id INNER JOIN book AS T3 ON T3.book_id = T2.book_id INNER JOIN publisher AS T4 ON T4.publisher_id = T3.publisher_id WHERE T4.publisher_name = 'VIZ Media';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the average number of book pages written by Zilpha Keatley Snyder?
SELECT AVG(T3.num_pages) FROM book_author AS T1 INNER JOIN author AS T2 ON T1.author_id = T2.author_id INNER JOIN book AS T3 ON T3.book_id = T1.book_id WHERE T2.author_name = 'Zilpha Keatley Snyder';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the full name of customer with email [email protected]?
SELECT first_name, last_name FROM customer WHERE email = '[email protected]';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Which book has the most number of pages?
SELECT title FROM book ORDER BY num_pages DESC LIMIT 1;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many books were written by author A.J. Ayer?
SELECT COUNT(*) FROM book_author AS T1 INNER JOIN author AS T2 ON T1.author_id = T2.author_id WHERE T2.author_name = 'A.J. Ayer';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Name the title of books written by author A.J.Ayer.
SELECT T3.title FROM book_author AS T1 INNER JOIN author AS T2 ON T1.author_id = T2.author_id INNER JOIN book AS T3 ON T3.book_id = T1.book_id WHERE T2.author_name = 'A.J. Ayer';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- The book name "The Season: A Candid Look at Broadway" was published by which publisher?
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'The Season: A Candid Look at Broadway';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the average of English books among all books published by Carole Marsh Mysteries?
SELECT CAST(SUM(CASE WHEN T1.language_name = 'English' THEN 1 ELSE 0 END) AS REAL) / COUNT(*) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id INNER JOIN publisher AS T3 ON T3.publisher_id = T2.publisher_id WHERE T3.publisher_name = 'Carole Marsh Mysteries';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Name the title of the book with the most number of pages that was published from 1990 to 2000 by publisher Free Press.
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Free Press' AND STRFTIME('%Y', T1.publication_date) BETWEEN '1990' AND '2000' ORDER BY T1.num_pages DESC LIMIT 1;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the order price of the book "The Servant Leader" in 2003?
SELECT T2.price FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'The Servant Leader' AND STRFTIME('%Y', T1.publication_date) = '2003';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the current address of customer Kandy?
SELECT T3.street_number, T3.street_name, T3.city 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 address_status AS T4 ON T4.status_id = T2.status_id WHERE T1.first_name = 'Kandy';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many books were ordered by customer Kandy Adamec?
SELECT 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 = 'Kandy' AND T3.last_name = 'Adamec';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many orders got returned in 2022?
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Returned' AND STRFTIME('%Y', T2.status_date) = '2022';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Which country does the customer with the email "[email protected]" from?
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.email = '[email protected]';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Name the publisher who published the most books.
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 schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the title of the first book that was written by A.J. Ayer?
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 = 'A.J. Ayer' ORDER BY T1.publication_date ASC LIMIT 1;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the percentage of books that cost greater than $10 and were ordered by customer Ruthanne Vatini?
SELECT CAST(SUM(CASE WHEN T1.price > 10 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 = 'Ruthanne' AND T3.last_name = 'Vatini';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- List the title of books published by AK Press.
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'AK Press';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Who ordered the book with the cheapest price?
SELECT T3.first_name, T3.last_name 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 ORDER BY T1.price ASC LIMIT 1;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- List down the ISBN of the books purchased by the customer with an email of [email protected].
SELECT T1.isbn13 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.email = '[email protected]';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Give the author's name of the books that cost 19 dollars and above.
SELECT DISTINCT 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 order_line AS T4 ON T4.book_id = T1.book_id WHERE T4.price > 19;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Provide the publisher name of the book with ISBN 76092025986.
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.isbn13 = 76092025986;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Among the books published by Birlinn in 2008, how many books have pages around 600 to 700?
SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Birlinn' AND STRFTIME('%Y', T1.publication_date) = '2008' AND T1.num_pages BETWEEN 600 AND 700;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the price of the book with ISBN 9780763628321?
SELECT T2.price FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.isbn13 = 9780763628321;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- What is the number of pages of the book in the order ID 1167?
SELECT T1.num_pages FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T2.order_id = 1167;
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Provide the title of the books published in British-English.
SELECT DISTINCT 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 schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- How many books were published by Brava in 2006?
SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Brava' AND STRFTIME('%Y', T1.publication_date) = '2006';
-- Database schema | address_status : status_id [ INTEGER ] primary_key , address_status [ TEXT ] | author : author_id [ INTEGER ] primary_key , author_name [ TEXT ] | book_language : language_id [ INTEGER ] primary_key , language_code [ TEXT ] , language_name [ TEXT ] | country : country_id [ INTEGER ] primary_key , country_name [ TEXT ] | address : address_id [ INTEGER ] primary_key , street_number [ TEXT ] , street_name [ TEXT ] , city [ TEXT ] , country_id [ INTEGER ] address.country_id = country.country_id | customer : customer_id [ INTEGER ] primary_key , first_name [ TEXT ] , last_name [ TEXT ] , email [ TEXT ] | customer_address : customer_id [ INTEGER ] customer_address.customer_id = customer.customer_id , address_id [ INTEGER ] customer_address.address_id = address.address_id , status_id [ INTEGER ] | order_status : status_id [ INTEGER ] primary_key , status_value [ TEXT ] | publisher : publisher_id [ INTEGER ] primary_key , publisher_name [ TEXT ] | book : book_id [ INTEGER ] primary_key , title [ TEXT ] , isbn13 [ TEXT ] , language_id [ INTEGER ] book.language_id = book_language.language_id , num_pages [ INTEGER ] , publication_date [ DATE ] , publisher_id [ INTEGER ] book.publisher_id = publisher.publisher_id | book_author : book_id [ INTEGER ] book_author.book_id = book.book_id , author_id [ INTEGER ] book_author.author_id = author.author_id | shipping_method : method_id [ INTEGER ] primary_key , method_name [ TEXT ] , cost [ REAL ] | cust_order : order_id [ INTEGER ] primary_key , order_date [ DATETIME ] , customer_id [ INTEGER ] , shipping_method_id [ INTEGER ] , dest_address_id [ INTEGER ] | order_history : history_id [ INTEGER ] primary_key , order_id [ INTEGER ] , status_id [ INTEGER ] , status_date [ DATETIME ] | order_line : line_id [ INTEGER ] primary_key , order_id [ INTEGER ] , book_id [ INTEGER ] , price [ REAL ] | -- -- Provide the ISBN and price of the book with book ID 7160.
SELECT T1.isbn13, T2.price FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T2.book_id = 6503;