problem
stringlengths
121
422
db_id
stringclasses
69 values
solution
stringlengths
23
804
Write SQL query to solve given problem: Identify by their id all the orders that have been cancelled.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: What is the status of the orders placed on 04/10/2022?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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%'
Write SQL query to solve given problem: What is the highest price at which a customer bought the book 'The Prophet'?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: On what dates were books ordered at a price of 16.54?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: List the titles of all the books that Peter H. Smith wrote.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: How many books under 300 pages has HarperCollins Publishers published?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: How many books have been published in Japanese?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
SELECT COUNT(*) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id WHERE T1.language_name = 'Japanese'
Write SQL query to solve given problem: What is the average number of pages in the books written by Jennifer Crusie?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: What percentage of the orders placed by Kaleena were shipped by the international method?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Provide the full name of the customers who have ordered the book The Sorrows of Young Werther.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: List every book that Ursola Purdy has ordered.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Who is the author of the book with the biggest page count?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: How many books written by Akira Watanabe are available on Gravity?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Provide the full address of Ursola Purdy.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Who is the author of the book The Mystery in the Rocky Mountains?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Identify the publisher of the book Girls' Night In.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Name the publisher of the oldest book.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: Identify the cost difference between Priority and Express shipping methods.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: How many orders have been cancelled in 2022?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: List all the books published by BBC Audiobooks.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: How many books were published in 2017?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
SELECT COUNT(*) FROM book WHERE STRFTIME('%Y', publication_date) = '2017'
Write SQL query to solve given problem: Provide the International Standard Book Number of the book The Mystery in the Rocky Mountains.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
SELECT isbn13 FROM book WHERE title = 'The Mystery in the Rocky Mountains'
Write SQL query to solve given problem: Among all orders updated in 2022, identify the percentage that has been returned.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Among all addresses provided by customers, identify the percentage that are not in use anymore.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: How many pages does 'Seaward' have?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
SELECT num_pages FROM book WHERE title = 'Seaward'
Write SQL query to solve given problem: Who is the author of First Things First?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: List all books authored by Tom Clancy.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Which book by Hirohiko Araki was published on 6/6/2006?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Who is the publisher of Hitchhiker's Guide To The Galaxy: The Filming of the Douglas Adams classic?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: List all books published by ADV Manga.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Write the full name of the customers whose address is at 55 Dorton Pass, Huangqiao.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Which country is 9 Green Ridge Point, Arendal located at?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: List 10 addresses located in Poland.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: What is the shipping method ordered by Nicolette Sadler at 6/29/2020 7:40:07 PM?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: List all books written in Arabic.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Which language is 'El plan infinito' written in?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: What percentage of books written by Hirohiko make up the number of books published by Viz Media?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: What is the average number of book pages written by Zilpha Keatley Snyder?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: What is the full name of customer with email [email protected]?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
SELECT first_name, last_name FROM customer WHERE email = '[email protected]'
Write SQL query to solve given problem: Which book has the most number of pages?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
SELECT title FROM book ORDER BY num_pages DESC LIMIT 1
Write SQL query to solve given problem: How many books were written by author A.J. Ayer?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Name the title of books written by author A.J.Ayer.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: The book name "The Season: A Candid Look at Broadway" was published by which publisher?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: What is the average of English books among all books published by Carole Marsh Mysteries?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Name the title of the book with the most number of pages that was published from 1990 to 2000 by publisher Free Press.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: What is the order price of the book "The Servant Leader" in 2003?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: What is the current address of customer Kandy?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: How many books were ordered by customer Kandy Adamec?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: How many orders got returned in 2022?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Which country does the customer with the email "[email protected]" from?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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]'
Write SQL query to solve given problem: Name the publisher who published the most books.. Keep the solution inside sql tag ```sql [SQL-Query] ```
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
Write SQL query to solve given problem: What is the title of the first book that was written by A.J. Ayer?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: What is the percentage of books that cost greater than $10 and were ordered by customer Ruthanne Vatini?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: List the title of books published by AK Press.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Who ordered the book with the cheapest price?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: List down the ISBN of the books purchased by the customer with an email of [email protected].. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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]'
Write SQL query to solve given problem: Give the author's name of the books that cost 19 dollars and above.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: Provide the publisher name of the book with ISBN 76092025986.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.isbn13 = 76092025986
Write SQL query to solve given problem: Among the books published by Birlinn in 2008, how many books have pages around 600 to 700?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: What is the price of the book with ISBN 9780763628321?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
SELECT T2.price FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.isbn13 = 9780763628321
Write SQL query to solve given problem: What is the number of pages of the book in the order ID 1167?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: Provide the title of the books published in British-English.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: How many books were published by Brava in 2006?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Provide the ISBN and price of the book with book ID 7160.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: What is the title of the book in the order ID 931?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: What is the language of the book titled Zorro?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Provide the email of the customers that purchased books with a price range of 3 to 5 dollars.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: List the ISBN of the books that cost 7.5 dollars.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: Give the publisher's name of the books authored by Alan Lee.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: What is the sum of the number of pages of the books ordered by Mick Sever?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: Write down the author's name of the book most recently published.. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: In books published by Ace Book, what is the percentage of English books published?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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'
Write SQL query to solve given problem: 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?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: What are the language and title of the ordered books with price less than 20% of the average price of all ordered books?. Keep the solution inside sql tag ```sql [SQL-Query] ```
books
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
Write SQL query to solve given problem: Please list the full names of all the sanitarians under the supervision of Darlisha Jacobs.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
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' )
Write SQL query to solve given problem: Please list the full names of the sanitarians who did at least one inspection in May, 2010.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT DISTINCT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE strftime('%Y-%m', T2.inspection_date) = '2010-05' AND T1.title = 'Sanitarian'
Write SQL query to solve given problem: How many inspections were sanitarian Joshua Rosa responsible for in 2010?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT COUNT(T2.inspection_id) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE strftime('%Y', T2.inspection_date) = '2010' AND T1.first_name = 'Joshua' AND T1.last_name = 'Rosa'
Write SQL query to solve given problem: Please list the assumed name of all the facilities inspected by Joshua Rosa.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
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'
Write SQL query to solve given problem: Among the facilities that have undergone at least one inspection in 2010, how many of them are restaurants or cafeterias?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT COUNT(DISTINCT T1.license_no) FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T1.inspection_date) = '2010' AND T2.facility_type = 'Restaurant'
Write SQL query to solve given problem: Please list the location coordinates of all the facilities that had an inspection on 2010/5/11.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
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'
Write SQL query to solve given problem: Among the facilities that have undergone at least one inspection in 2010, how many of them are in ward no.42?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT COUNT(DISTINCT T1.license_no) FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T1.inspection_date) = '2010' AND T2.ward = 42
Write SQL query to solve given problem: Please list the full names of all the sanitarians who have inspected the facility Burbank.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
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'
Write SQL query to solve given problem: Please list the assumed name of all the facilities that failed an inspection in 2010.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT DISTINCT T2.dba_name FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE T1.results = 'Fail' AND strftime('%Y', T1.inspection_date) = '2010'
Write SQL query to solve given problem: What is the full name of the sanitarian who inspected Amundsen High School on 2010/5/11?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
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'
Write SQL query to solve given problem: Among the inspections done by sanitarian Joshua Rosa, how many of them have the result of "pass"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
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'
Write SQL query to solve given problem: After Azha Restaurant Inc. passed the inspection on 2010/1/21, when was the follow-up inspection done?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
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'
Write SQL query to solve given problem: Among the facilities that had undergone at least one inspection in 2010, how many of them have the most serious food safety issues?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT COUNT(DISTINCT T2.license_no) FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T1.inspection_date) = '2010' AND T2.risk_level = 3
Write SQL query to solve given problem: What is the average number of inspections carried out in the year 2010 by a sanitarian whose salary is over 70000?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT CAST(SUM(CASE WHEN T2.inspection_date LIKE '2010%' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.salary > 70000 THEN 1 ELSE 0 END) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id
Write SQL query to solve given problem: What is the point level of "Refrigeration and metal stem thermometers provided and conspicuous"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT point_level FROM inspection_point WHERE Description = 'Refrigeration and metal stem thermometers provided and conspicuous '
Write SQL query to solve given problem: Which employee was responsible for inspection no.48224? Give the full name.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
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
Write SQL query to solve given problem: How many inspections did All Style Buffet Restaurant have?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
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'
Write SQL query to solve given problem: When did Wing Hung Chop Suey Restaurant have its first inspection?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT MIN(T2.inspection_date) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.aka_name = 'WING HUNG CHOP SUEY RESTAURANT'
Write SQL query to solve given problem: How many restaurants were inspected on 2015/5/8?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT COUNT(T2.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.inspection_date = '2015-05-08' AND T1.facility_type = 'Restaurant'
Write SQL query to solve given problem: How many "food maintenance" related violations did inspection no.1454071 have?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT COUNT(T2.point_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspection_id = '1454071' AND T1.category = 'Food Maintenance'
Write SQL query to solve given problem: State the number of violations did Royal Thai Cuisine has during the 2015/5/8 inspection.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT COUNT(T3.point_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T2.inspection_date = '2015-05-08' AND T1.dba_name = 'ROYAL THAI CUISINE'
Write SQL query to solve given problem: For the grocery store located at "3635 W DIVERSEY AVE", how many inspections did it have?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT COUNT(T2.inspection_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.address = '3635 W DIVERSEY AVE ' AND T1.facility_type = 'Grocery Store'
Write SQL query to solve given problem: Who is responsible for most of the inspections? Give the full name.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT T.first_name, T.last_name FROM ( SELECT T2.employee_id, T2.first_name, T2.last_name, COUNT(T1.inspection_id) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id GROUP BY T2.employee_id, T2.first_name, T2.last_name ORDER BY COUNT(T1.inspection_id) DESC LIMIT 1 ) AS T
Write SQL query to solve given problem: How many inspections done by Lisa Tillman ended up with the result of "Out of Business"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT COUNT(T1.inspection_id) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T2.first_name = 'Lisa' AND T2.last_name = 'Tillman' AND T1.results = 'Out of Business'
Write SQL query to solve given problem: For the sanitarian who lives on 5000 N Wolcott Ave, how many establishments did he/she inspect in the May of 2011?. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT COUNT(T1.inspection_id) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T2.address = '5000 N Wolcott Ave' AND T2.title = 'Sanitarian' AND strftime('%Y-%m', T1.inspection_date) = '2011-05'
Write SQL query to solve given problem: Show the phone number of the sanitarian who was responsible for inspection no.634597.. Keep the solution inside sql tag ```sql [SQL-Query] ```
food_inspection_2
SELECT T2.phone FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T1.inspection_id = 634597 AND T2.title = 'Sanitarian'