db_id
stringclasses
68 values
question
stringlengths
24
325
evidence
stringlengths
0
580
SQL
stringlengths
23
728
books
Who is the author who wrote the most books?
author refers to author_name; who wrote the most book refers to Max(Count(author_id))
SELECT T1.author_name FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_name ORDER BY COUNT(T2.author_id) DESC LIMIT 1
books
What are the books published by "Harper Collins"?
"Harper Collins" is the publisher_name; books refers to title
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Harper Collins'
books
How many of the customer addresses are inactive?
addresses are inactive refers to address_status = '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'
books
What is the book with the most orders?
books refers to title; the most orders refers to Max(Count(order_id))
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
books
What is the address that received the most orders?
address refers to street_name, city; received the most orders refers to Max(count(dest_address_id))
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
books
Which customer has the most addresses?
customer refers to first_name, last_name; the most address refers to Max(count(address_id))
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
books
What percentage of the total prices of all orders are shipped internationally?
shipped internationally refers to method_name = 'International'; percentage = Divide (Sum(price where method_name = 'International'), Sum(price)) * 100
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
books
List all the authors who wrote fewer pages than the average.
author refers to author_name; who wrote fewer pages than the average refers to num_pages < AVG(num_pages)
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 )
books
Other than zero, what is the lowest price paid by a customer for an order?
other than 0 refers to price ! = 0; lowest price paid refers to Min(price)
SELECT MIN(price) FROM order_line WHERE price <> 0
books
How many customers have an address that is located in the city of Villeneuve-la-Garenne?
"Villeneuve-la-Garenne" is the city
SELECT COUNT(address_id) FROM address WHERE city = 'Villeneuve-la-Garenne'
books
How many authors are named Adam?
authors named Adam refers to author_name LIKE 'Adam'
SELECT COUNT(*) FROM author WHERE author_name LIKE 'Adam%'
books
How many customers use a Yahoo! Mail e-mail address?
Yahoo! Mail e-mail address refers to email LIKE '%@yahoo.com'
SELECT COUNT(*) FROM customer WHERE email LIKE '%@yahoo.com'
books
What are the city addresses of the customers located in the United States of America?
"United States of America" is the country_name
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'
books
Which books have the most expensive price?
most expensive book refers to Max(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
books
How many customers ordered the book titled "Anleitung zum Zickigsein"
"Anleitung zum Zickigsein" is the title of the book
SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'Anleitung zum Zickigsein'
books
What is the most expensive price paid by a customer for the book "Bite Me If You Can (Argeneau #6)"?
"Bite Me If You Can (Argeneau #6)" is the title of the book; most expensive price refers to Max(price)
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)'
books
How many customers ordered the oldest book?
oldest book refers to Min(publiation_date)
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
books
List all the titles of the Spanish books published by Alfaguara.
"Spanish" is the language_name; 'Alfaguara' is the publisher_name
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
books
What are the languages of the first two published books?
first two published book refers to Min(publication_date); language refers to language_name
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id ORDER BY T1.publication_date ASC LIMIT 2
books
Who published the book "The Secret Garden"?
"The Secret Garden" is the title of the book; who published the book refers to publisher_name
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'
books
Among the books that were published by Scholastic, how many were written by J.K Rowling?
"J.K Rowling" is the author_name; 'Scholastic' is the publisher_name
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'
books
What are the names of all the publishers who have published at least 30 books?
published at least 30 books refers to Count(book_id) > = 30
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
books
Indicate the last number of each street.
street refers to street_name; last number of each street refers to Substr (street_number, -1)
SELECT street_number FROM address
books
Indicate the complete address of customers located in Lazaro Cardenas.
complete address refers to street_number, street_name, city, country; "Lazaro Cardenas" is the city
SELECT street_number, street_name, city, country_id FROM address WHERE city = 'Lazaro Cardenas'
books
Indicate the ISBN13 of all the books that have less than 140 pages and more than 135.
ISBN13 refers to isbn13; less than 140 pages and more than 135 refers to num_pages > 135 AND num_pages < 140;
SELECT isbn13 FROM book WHERE num_pages < 140 AND num_pages > 135
books
Indicate the title of the six books with the greatest potential value as collectibles.
greatest potential value refers to Min(publication_date)
SELECT title FROM book ORDER BY publication_date ASC LIMIT 6
books
Indicate the full name of all customers whose last name begins with the letter K.
full name refers to first_name, last_name; last name begin with the letter 'K' refers to last_name LIKE 'K%'
SELECT first_name, last_name FROM customer WHERE last_name LIKE 'K%'
books
In which cities are the customers of Costa Rica located?
"Costa Rica" is the country_name
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'
books
Which customer addresses are no longer active?
no longer active refers to address_status = 'Inactive'; customer address refers to street_number, street_name, city
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'
books
What is the full name of the customers who live in Baiyin city?
full name refers to first_name, last_name; 'Baiyin' is the 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'
books
What is the email of the customers who place their orders with priority method?
priority method refers to method_name = 'Priority'
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'
books
Identify by their id all the orders that have been cancelled.
have been cancelled refers to status_value = 'cancelled'; id refers to order_id
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'
books
What is the highest price at which a customer bought the book 'The Prophet'?
"The Prophet" is the title of the book; highest price refers to Max(price)
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'
books
List the titles of all the books that Peter H. Smith wrote.
"Peter H.Smit" is the author_name
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'
books
How many books under 300 pages has HarperCollins Publishers published?
under 300 pages refers to num_pages < 300; 'HarperCollins Publishers" is the publisher_name
SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'HarperCollins Publishers' AND T1.num_pages < 300
books
How many books have been published in Japanese?
in Japanese refers to language_name = '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'
books
What is the average number of pages in the books written by Jennifer Crusie?
"Jennifer Crusie" is the author_name; average number of pages refers to AVG(num_pages)
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'
books
What percentage of the orders placed by Kaleena were shipped by the international method?
shipped by international method refers to method_name = 'International'; percentage = Divide (Sum(method_name = 'International'), Count(method_name)) * 100
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'
books
Provide the full name of the customers who have ordered the book The Sorrows of Young Werther.
full name refers to first_name, last_name; 'The Sorrows of Young Werther' is the title of the book
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'
books
List every book that Ursola Purdy has ordered.
book refers to title
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'
books
Who is the author of the book with the biggest page count?
author refers to author_name, biggest page count refers to Max(num_pages)
SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id ORDER BY T1.num_pages DESC LIMIT 1
books
How many books written by Akira Watanabe are available on Gravity?
"Akira Watanabe" is the author_name
SELECT COUNT(*) FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id WHERE T1.author_name = 'Akira Watanabe'
books
Provide the full address of Ursola Purdy.
full address refers to street_number, street_name, city, country_name
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'
books
Who is the author of the book The Mystery in the Rocky Mountains?
author refers to author_name; 'The Mystery in the Rocky Mountains' is the title of the book
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'
books
Identify the publisher of the book Girls' Night In.
"Girls' Night In" is the title of the book; publisher is the publisher_name
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'Girls'' Night In'
books
Name the publisher of the oldest book.
publisher refers to publisher_name;  oldest book refers to Min(publication_date)
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
books
Identify the cost difference between Priority and Express shipping methods.
"Priority" and "Express" are both method_name; cost difference = Subtract (Sum(cost where method_name = 'Express'), Sum(cost where method_name 'Priority'))
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
books
List all the books published by BBC Audiobooks.
"BBC Audiobooks" refers to publisher_name; books refers to title
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'BBC Audiobooks'
books
Provide the International Standard Book Number of the book The Mystery in the Rocky Mountains.
International Standard Book Number refers to isbn13; 'The Mystery in the Rocky Mountains' is the title of the book
SELECT isbn13 FROM book WHERE title = 'The Mystery in the Rocky Mountains'
books
Among all addresses provided by customers, identify the percentage that are not in use anymore.
address not in use refers to address_status = 'Inactive'; percentage = Divide (Count(address_status = 'Inactive'), Count(address_status)) * 100
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
books
How many pages does 'Seaward' have?
"Seaward" is the title of the book; pages refers to num_pages
SELECT num_pages FROM book WHERE title = 'Seaward'
books
Who is the author of First Things First?
"First Things First" is the title of the book; author refers to author_name
SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T1.title = 'First Things First'
books
List all books authored by Tom Clancy.
"Tom Clancy" is the author_name; books refers title
SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Tom Clancy'
books
Which book by Hirohiko Araki was published on 6/6/2006?
"Hirohiko Araki" is the author_name; on 6/6/2006 refers to publication_date = '2006-06-06'; which book refers to title
SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Hirohiko Araki' AND T1.publication_date = '2006-06-06'
books
Who is the publisher of Hitchhiker's Guide To The Galaxy: The Filming of the Douglas Adams classic?
"Hitchhiker's Guide To The Galaxy: The Filming of the Douglas Adams classic" is the title of the book; publisher refers to publisher_name
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'Hitchhiker''s Guide To The Galaxy: The Filming of the Douglas Adams classic'
books
List all books published by ADV Manga.
"ADV Manga" is the publisher_name; books refers to title
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'ADV Manga'
books
List 10 addresses located in Poland.
"Polan" is the country_name; address refers to street_number, street_name, city
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
books
What is the shipping method ordered by Nicolette Sadler at 6/29/2020 7:40:07 PM?
ordered at 6/29/2020 7:40:07 PM refers to order_date = '2020-06-29 19:40:07'; shipping method refers to method_name
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'
books
List all books written in Arabic.
"Arabic" is the language_name; book refers to title
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'
books
Which language is 'El plan infinito' written in?
"El plan infinito" is the title of the book; language refers to language_name
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'El plan infinito'
books
What percentage of books written by Hirohiko make up the number of books published by Viz Media?
"Hirohiko Araki" is the author_name; 'Viz Media' is the publisher_name; percentage = Divide (Count(author_name = 'Hirohiko Araki'), Count(book_id)) * 100
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'
books
What is the average number of book pages written by Zilpha Keatley Snyder?
"Zilpha Keatley Snyder" is the author_name; average number of book pages refers to AVG(num_pages)
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'
books
What is the full name of customer with email ckupis4@tamu.edu?
"ckupis4@tamu.edu" is the email of customer; full name refers to first_name, last_name
SELECT first_name, last_name FROM customer WHERE email = 'ckupis4@tamu.edu'
books
Which book has the most number of pages?
books with the most number of pages refers to Max(num_pages)
SELECT title FROM book ORDER BY num_pages DESC LIMIT 1
books
How many books were written by author A.J. Ayer?
"A.J. Ayer" is the author_name;
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'
books
Name the title of books written by author A.J.Ayer.
"A.J. Ayer" is the author_name;
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'
books
The book name "The Season: A Candid Look at Broadway" was published by which publisher?
"The Season: A Candid Look at Broadway" is the  title of the book; publisher refers to publisher_name
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'The Season: A Candid Look at Broadway'
books
What is the average of English books among all books published by Carole Marsh Mysteries?
English book refers to language_name = 'English'; 'Carole Marsh Mysteries' is the publisher_name; average = Divide (Count(language_name = 'English'), Count(book_id))
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'
books
What is the current address of customer Kandy?
current address refers to address_status = 1; address refers to street_number, street_name, city
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'
books
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'
books
Name the publisher who published the most books.
published the most books refers to Max(Count(book_id)); publisher refers to publisher_name
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name ORDER BY COUNT(T2.publisher_id) DESC LIMIT 1
books
What is the title of the first book that was written by A.J. Ayer?
"A.J. Ayer" is the author_name; first book refers to Min(publication_date)
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
books
What is the percentage of books that cost greater than $10 and were ordered by customer Ruthanne Vatini?
cost greater than $10 refers to price > 10; percentage = Divide (Count(book_id where price >10), Count(book_id)) * 100; full name refers to the composition of first name, lastname
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'
books
List the title of books published by AK Press.
"AK Press" is the publisher_name
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'
books
Who ordered the book with the cheapest price?
book with cheapest price refers to Min(price); who order means name of customer which refers to first_name, last_name
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
books
List down the ISBN of the books purchased by the customer with an email of fsier3e@ihg.com.
"fsier3e@ihg.com" is the email of customer; ISBN refers to isbn13
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 = 'fsier3e@ihg.com'
books
Give the author's name of the books that cost 19 dollars and above.
books cost 19 dollars and above refers to price > = 19
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
books
What is the number of pages of the book in the order ID 1167?
number of pages refers to num_pages
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
books
Provide the title of the books published in British-English.
"British English" is the language_name of the book
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'
books
Provide the ISBN and price of the book with book ID 7160.
ISBN refers to isbn13;
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
books
What is the title of the book in the order ID 931?
SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T2.order_id = 931
books
What is the language of the book titled Zorro?
"Zorro" is the title of the book; langauge refers to language_name
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'Zorro'
books
Provide the email of the customers that purchased books with a price range of 3 to 5 dollars.
books with a price range of 3 to 5 dollars refers to price BETWEEN 3 AND 5
SELECT DISTINCT T3.email 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 T1.price BETWEEN 3 AND 5
books
List the ISBN of the books that cost 7.5 dollars.
ISBN refers to isbn13; books cost 7.5 dollars refers to price = 7.5
SELECT T1.isbn13 FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T2.price = 7.5
books
Give the publisher's name of the books authored by Alan Lee.
"Alan Lee" is the author_name; publisher's name refers to publisher_name
SELECT T4.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'Alan Lee' GROUP BY T4.publisher_name
books
What is the sum of the number of pages of the books ordered by Mick Sever?
sum of the number of pages refers to Sum(num_pages)
SELECT SUM(T1.num_pages) 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 = 'Mick' AND T4.last_name = 'Sever'
books
Write down the author's name of the book most recently published.
author's name refers to author_name; book most recently published refers to Max(publication_date)
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.publication_date DESC LIMIT 1
books
In books published by Ace Book, what is the percentage of English books published?
"Ace Book" is the publisher_name; English book refers to language_name = 'English'; percentage = Divide (Count(book_id where language_name = 'English'), Count(book_id)) * 100
SELECT CAST(SUM(CASE WHEN T1.language_name = 'English' THEN 1 ELSE 0 END) AS REAL) * 100 / 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 = 'Ace Book'
books
Among the books purchased by less than 1 dollar, what is the difference between the number of books with less than 500 pages and books with greater than 500 pages?
book purchased by less than 1 dollar refers to price < 1; books with less than 500 pages refers to num_pages < 500; greater than 500 pages refers to num_pages > 500; Difference = Subtract (Count(book_id where num_pages < 500), Count(book_id where num_pages > 500))
SELECT SUM(CASE WHEN T1.num_pages < 500 THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.num_pages > 500 THEN 1 ELSE 0 END) AS dif FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T2.price < 1
books
What are the language and title of the ordered books with price less than 20% of the average price of all ordered books?
language refers to language_name; books with price less than 20% of the average price refers to price < Multiply (AVG(price), 0.2)
SELECT DISTINCT T3.language_name, T2.title FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id INNER JOIN book_language AS T3 ON T3.language_id = T2.language_id WHERE T1.price * 100 < ( SELECT AVG(price) FROM order_line ) * 20
food_inspection_2
Please list the full names of all the sanitarians under the supervision of Darlisha Jacobs.
full name refers to first_name, last_name
SELECT first_name, last_name FROM employee WHERE title = 'Sanitarian' AND supervisor = ( SELECT employee_id FROM employee WHERE first_name = 'Darlisha' AND last_name = 'Jacobs' )
food_inspection_2
Please list the assumed name of all the facilities inspected by Joshua Rosa.
assumed name refers to dba_name
SELECT DISTINCT T3.dba_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T1.first_name = 'Joshua' AND T1.last_name = 'Rosa'
food_inspection_2
Please list the location coordinates of all the facilities that had an inspection on 2010/5/11.
location coordinates refers to latitude, longitude; on 2010/5/11 refers to inspection_date = '2010-05-11'
SELECT DISTINCT T2.latitude, T2.longitude FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE T1.inspection_date = '2010-05-11'
food_inspection_2
Please list the full names of all the sanitarians who have inspected the facility Burbank.
full name refers to first_name, last_name; the facility Burbank refers to dba_name = 'Burbank'
SELECT DISTINCT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T3.dba_name = 'Burbank' AND T1.title = 'Sanitarian'
food_inspection_2
What is the full name of the sanitarian who inspected Amundsen High School on 2010/5/11?
full name refers to first_name, last_name;  Amundsen High School refers to dba_name = 'AMUNDSEN HIGH SCHOOL'; on 2010/5/11 refers to inspection_date = '2010-05-11'
SELECT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T2.inspection_date = '2010-05-11' AND T3.dba_name = 'AMUNDSEN HIGH SCHOOL' AND T1.title = 'Sanitarian'
food_inspection_2
Among the inspections done by sanitarian Joshua Rosa, how many of them have the result of "pass"?
have the result of "pass" refers to results = 'Pass'
SELECT COUNT(T2.inspection_id) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.results = 'Pass' AND T1.first_name = 'Joshua' AND T1.last_name = 'Rosa'
food_inspection_2
After Azha Restaurant Inc. passed the inspection on 2010/1/21, when was the follow-up inspection done?
Azha Restaurant Inc. refers to dba_name = 'Azha Restaurant Inc.'; on 2010/1/21 refers to inspection_date = '2010-01-21'; follow-up inspection date refers to followup_to
SELECT T1.followup_to FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE T2.dba_name = 'Azha Restaurant Inc.' AND T1.results = 'Pass' AND T1.inspection_date = '2010-01-21'
food_inspection_2
What is the point level of "Refrigeration and metal stem thermometers provided and conspicuous"?
"Refrigeration and metal stem thermometers provided and conspicuous" refers to Description = 'Refrigeration and metal stem thermometers provided and conspicuous '
SELECT point_level FROM inspection_point WHERE Description = 'Refrigeration and metal stem thermometers provided and conspicuous '
food_inspection_2
Which employee was responsible for inspection no.48224? Give the full name.
inspection no.48224 refers to inspection_id = '48224'; full name refers to first_name, last_name;
SELECT T2.first_name, T2.last_name FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T1.inspection_id = 48224
food_inspection_2
How many inspections did All Style Buffet Restaurant have?
All Style Buffet refers to dba_name = 'All Style Buffet'; Restaurant refers to facility_type = 'Restaurant'
SELECT COUNT(T2.inspection_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.facility_type = 'Restaurant' AND T1.dba_name = 'All Style Buffet'