context
stringlengths 11
9.12k
| question
stringlengths 0
1.06k
| SQL
stringlengths 2
4.44k
| source
stringclasses 28
values |
|---|---|---|---|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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%'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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%'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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%'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
How many pages does 'Seaward' have?
|
SELECT num_pages FROM book WHERE title = 'Seaward'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
What is the full name of customer with email ckupis4@tamu.edu?
|
SELECT first_name, last_name FROM customer WHERE email = 'ckupis4@tamu.edu'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
Which country does the customer with the email "rturbitt2@geocities.jp" 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 = 'rturbitT2@geocities.jp'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
List down the ISBN of the books purchased by the customer with an email of fsier3e@ihg.com.
|
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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, 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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
What is the language of the book titled Zorro?
|
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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
Provide the email of the customers that purchased books with a price range of 3 to 5 dollars.
|
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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
List the ISBN of the books that cost 7.5 dollars.
|
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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
Give the publisher's name of the books authored by Alan Lee.
|
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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
What is the sum of the number of pages of the books ordered by Mick Sever?
|
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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
Write down the author's name of the book most recently published.
|
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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
In books published by Ace Book, what is the percentage of English books published?
|
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'
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
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?
|
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
|
bird
|
CREATE TABLE books (status_id integer, address_status text, author_id integer, author_name text, language_id integer, language_code text, language_name text, country_id integer, country_name text, address_id integer, street_number text, street_name text, city text, country_id integer, customer_id integer, first_name text, last_name text, email text, customer_id integer, address_id integer, status_id integer, status_id integer, status_value text, publisher_id integer, publisher_name text, book_id integer, title text, isbn13 text, language_id integer, num_pages integer, publication_date date, publisher_id integer, book_id integer, author_id integer, method_id integer, method_name text, cost real, order_id integer, order_date datetime, customer_id integer, shipping_method_id integer, dest_address_id integer, history_id integer, order_id integer, status_id integer, status_date datetime, line_id integer, order_id integer, book_id integer, price real)
|
What are the language and title of the ordered books with price less than 20% of the average price of all ordered 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
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
Please list the full names of all the sanitarians under the supervision of Darlisha Jacobs.
|
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' )
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
Please list the full names of the sanitarians who did at least one inspection in May, 2010.
|
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'
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
How many inspections were sanitarian Joshua Rosa responsible for in 2010?
|
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'
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
Please list the assumed name of all the facilities inspected by Joshua Rosa.
|
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'
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
Among the facilities that have undergone at least one inspection in 2010, how many of them are restaurants or cafeterias?
|
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'
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
Please list the location coordinates of all the facilities that had an inspection on 2010/5/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'
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
Among the facilities that have undergone at least one inspection in 2010, how many of them are in ward no.42?
|
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
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
Please list the full names of all the sanitarians who have inspected the facility 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'
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
Please list the assumed name of all the facilities that failed an inspection in 2010.
|
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'
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
What is the full name of the sanitarian who inspected Amundsen High School on 2010/5/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'
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
Among the inspections done by sanitarian Joshua Rosa, how many of them have the result of "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'
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
After Azha Restaurant Inc. passed the inspection on 2010/1/21, when was the follow-up inspection done?
|
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'
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
Among the facilities that had undergone at least one inspection in 2010, how many of them have the most serious food safety issues?
|
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
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
What is the average number of inspections carried out in the year 2010 by a sanitarian whose salary is over 70000?
|
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
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
What is the point level of "Refrigeration and metal stem thermometers provided and conspicuous"?
|
SELECT point_level FROM inspection_point WHERE Description = 'Refrigeration and metal stem thermometers provided and conspicuous '
|
bird
|
CREATE TABLE food_inspection_2 (employee_id integer, first_name text, last_name text, address text, city text, state text, zip integer, phone text, title text, salary integer, supervisor integer, license_no integer, dba_name text, aka_name text, facility_type text, risk_level integer, address text, city text, state text, zip integer, latitude real, longitude real, ward integer, inspection_id integer, inspection_date date, inspection_type text, results text, employee_id integer, license_no integer, followup_to integer, point_id integer, Description text, category text, code text, fine integer, point_level text, inspection_id integer, point_id integer, fine integer, inspector_comment text)
|
Which employee was responsible for inspection no.48224? Give the full 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
|
bird
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.