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)
How much money on average does Lucas Wyldbore spend on book orders?
SELECT SUM(T1.price) / COUNT(*) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'
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 ordered by Lucas Wyldbore, what is the percentage of those books over $13?
SELECT CAST(SUM(CASE WHEN T1.price > 13 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'
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 city does the address id 547 belong to?
SELECT city FROM address WHERE address_id = 547
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 has Cordy Dumbarton made?
SELECT COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Cordy' AND T1.last_name = 'Dumbarton'
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 the earliest published Japanese book.
SELECT T1.title FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'Japanese' 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)
For the publisher which published the most books, show its name.
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name ORDER BY COUNT(T2.publisher_id) DESC LIMIT 1
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 Kensington?
SELECT COUNT(T1.book_id) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Kensington'
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 was book id 1405 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.book_id = 1405
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 has made the most orders? Show his/her full name.
SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(*) DESC LIMIT 1
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 book title of the bestseller.
SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id GROUP BY T1.title ORDER BY COUNT(T1.title) DESC LIMIT 1
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 did David Foster Wallace write?
SELECT COUNT(T1.title) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'David Foster Wallace'
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 does the book "O Xará" have?
SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'O Xará'
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 Malina Johnson live in?
SELECT T4.country_name FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T3.address_id = T2.address_id INNER JOIN country AS T4 ON T4.country_id = T3.country_id WHERE T1.first_name = 'Malina' AND T1.last_name = 'Johnson' AND T2.status_id = 2
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 number of Ukrainian addresses in the database.
SELECT COUNT(*) FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id WHERE T1.country_name = 'Ukraine'
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 Žirovnica city belong to?
SELECT T1.country_name FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id WHERE T2.city = 'Žirovnica'
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)
Calculate the percentage of the International shipping orders on 2022/11/10.
SELECT CAST(SUM(CASE WHEN T1.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM shipping_method AS T1 INNER JOIN cust_order AS T2 ON T1.method_id = T2.shipping_method_id WHERE T2.order_date LIKE '2022-11-10%'
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 of David Coward's books?
SELECT AVG(T1.num_pages) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'David Coward'
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 cost of the slowest and least expensive shipping method?
SELECT method_name FROM shipping_method ORDER BY cost 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 title of the first book that was published in 1900?
SELECT title FROM book WHERE STRFTIME('%Y', publication_date) = '1900' ORDER BY publication_date 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 full name of the customer who owns the "[email protected]" e-mail address?
SELECT first_name, last_name FROM customer WHERE email = '[email protected]'
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 in 2022 have Iran as their destinations?
SELECT COUNT(*) FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id INNER JOIN cust_order AS T3 ON T3.dest_address_id = T2.address_id WHERE T1.country_name = 'Iran' AND STRFTIME('%Y', T3.order_date) = '2022'
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 Daisey Lamball's orders, how many were shipped via International shipping?
SELECT COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Daisey' AND T1.last_name = 'Lamball' AND T3.method_name = 'International'
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 customer who ordered the most books of all time?
SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(*) DESC LIMIT 1
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 did Antonia Poltun return?
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.status_value = 'Returned' AND T4.first_name = 'Antonia' AND T4.last_name = 'Poltun'
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 shipping method is preferred by customers the most?
SELECT T2.method_name FROM cust_order AS T1 INNER JOIN shipping_method AS T2 ON T1.shipping_method_id = T2.method_id GROUP BY T2.method_name ORDER BY COUNT(T2.method_id) DESC LIMIT 1
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 were delivered in 2021?
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Delivered' AND STRFTIME('%Y', T2.status_date) = '2021'
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 name of the first book written by J.K Rowling?
SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'J.K. Rowling' ORDER BY T1.publication_date ASC LIMIT 1
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 did A.R. Braunmuller write?
SELECT COUNT(*) FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id WHERE T1.author_name = 'A.R. Braunmuller'
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 name of the publisher who published Agatha Christie's first book?
SELECT T4.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'Agatha Christie' ORDER BY T1.publication_date ASC LIMIT 1
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 names of the books written by Danielle Steel.
SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Danielle Steel'
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 by William Shakespeare were published by Penguin Classics?
SELECT COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'William Shakespeare' AND T4.publisher_name = 'Penguin Classics'
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 name of the publisher that 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 total shipping cost of all the orders made by Page Holsey? Indicate how many of the said orders were ordered in 2022.
SELECT SUM(T3.cost) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Page' AND T1.last_name = 'Holsey' AND STRFTIME('%Y', T2.order_date) = '2022'
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 name of the publisher with publisher ID 22?
SELECT publisher_name FROM publisher WHERE publisher_id = 22
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 of the books authored by Al Gore have less than 400 pages?
SELECT COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Al Gore' AND T1.num_pages < 400
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 author's and publisher's name of the book published on July 10, 1997.
SELECT T3.author_name, T4.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T1.publication_date = '1997-07-10'
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 with ISBN 23755004321?
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T1.isbn13 = 23755004321
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 most expensive book?
SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id ORDER BY T2.price DESC LIMIT 1
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)
Calculate the total price of books ordered by customer named Lucas Wyldbore.
SELECT SUM(T1.price) FROM order_line AS T1 INNER JOIN cust_order AS T2 ON T2.order_id = T1.order_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T3.first_name = 'Lucas' AND T3.last_name = 'Wyldbore'
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 book published in Spanish.
SELECT T1.isbn13 FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id WHERE T2.language_name = 'Spanish'
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 that cost less than 1 dollar, how many were published by Berkley Trade?
SELECT COUNT(*) FROM publisher AS T1 INNER JOIN book AS T2 ON T1.publisher_id = T2.publisher_id INNER JOIN order_line AS T3 ON T3.book_id = T2.book_id WHERE T1.publisher_name = 'Berkley' AND T3.price < 1
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 the books purchased by the customer named Zia Roizin.
SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Zia' AND T4.last_name = 'Roizin'
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 authored the book with greatest number of pages?
SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id ORDER BY T1.num_pages DESC LIMIT 1
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 email of customers that bought the book titled Switch on the Night.
SELECT T4.email FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.title = 'Switch on the Night'
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 author's name of the books published by Abrams.
SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T4.publisher_name = 'Abrams'
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 publisher name of the book titled The Illuminati?
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'The Illuminati'
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 authored by Abraham Lincoln, what is the percentage of the books published in 1992?
SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', T1.publication_date) = '1992' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Abraham Lincoln'
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 in 2004, list the name of the publisher of books with number of pages greater than 70% of the average number of pages of all books.
SELECT T1.title, T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE STRFTIME('%Y', T1.publication_date) = '2004' AND T1.num_pages * 100 > ( SELECT AVG(num_pages) FROM book ) * 70
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 contact email of Moss Zarb.
SELECT email FROM customer WHERE first_name = 'Moss' AND last_name = 'Zarb'
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 streets in Dallas.
SELECT street_name FROM address WHERE city = 'Dallas'
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 books were released by Orson Scott Card in 2001?
SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Orson Scott Card' AND STRFTIME('%Y', T1.publication_date) = '2001'
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)
Count the number of books written by Orson Scott Card.
SELECT COUNT(*) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Orson Scott Card'
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 authors and titles of the books which have more than 3000 pages.
SELECT T3.author_name, T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T1.num_pages > 3000
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 wrote "The Prophet"?
SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T1.title = 'The Prophet'
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 Ace Hardcover?
SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Ace Hardcover'
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 publisher published Barry Eisler's book?
SELECT T4.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T3.author_name = 'Barry Eisler'
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 Japanese?
SELECT COUNT(T2.book_id) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id WHERE T1.language_name = 'Japanese'
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)
Sum the total price of the orders for The Prophet book.
SELECT SUM(T1.price) FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id WHERE T2.title = 'The Prophet'
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 number of orders by Daisey Lamball in 2021.
SELECT COUNT(*) FROM cust_order AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Daisey' AND T2.last_name = 'Lamball' AND STRFTIME('%Y', T1.order_date) = '2021'
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 customers are from Australia?
SELECT COUNT(*) FROM customer_address AS T1 INNER JOIN address AS T2 ON T2.address_id = T1.address_id INNER JOIN country AS T3 ON T3.country_id = T2.country_id WHERE T3.country_name = 'Australia'
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 were delivered in December 2019?
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Delivered' AND STRFTIME('%Y', T2.status_date) = '2019'
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 customers' names who ordered the Fantasmas.
SELECT T4.first_name, T4.last_name FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.title = 'Fantasmas'
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 percent of orders in 2020 used international shipping?
SELECT CAST(SUM(CASE WHEN T2.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM cust_order AS T1 INNER JOIN shipping_method AS T2 ON T1.shipping_method_id = T2.method_id WHERE STRFTIME('%Y', T1.order_date) = '2020'
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 authors named "George".
SELECT author_name FROM author WHERE author_name LIKE 'George%'
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 year has the most customer orders?
SELECT strftime('%Y', order_date) FROM cust_order GROUP BY strftime('%Y', order_date) ORDER BY COUNT(strftime('%Y', order_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)
What is the average price for the order line?
SELECT AVG(price) FROM order_line
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 of the books that were published in 1995.
SELECT title FROM book WHERE STRFTIME('%Y', publication_date) = '1995'
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 most common domain for the email address among all the customers?
SELECT SUBSTR(email, INSTR(email, '@') + 1, LENGTH(email) - INSTR(email, '@')) AS ym FROM customer GROUP BY SUBSTR(email, INSTR(email, '@') + 1, LENGTH(email) - INSTR(email, '@')) ORDER BY COUNT(*) DESC LIMIT 1
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 publishers have the word "book" in their name?
SELECT COUNT(*) FROM publisher WHERE publisher_name LIKE '%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)
Which language is the rarest among all the books?
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id GROUP BY T2.language_name ORDER BY COUNT(T2.language_name) ASC LIMIT 1
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 order dates for the customer named "Adrian Kunzelmann".
SELECT T3.order_date FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Adrian' AND T4.last_name = 'Kunzelmann'
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 addresses are from the Philippines?
SELECT COUNT(T2.country_id) FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Philippines'
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 who wrote the most books?
SELECT T1.author_name FROM author AS T1 INNER JOIN book_author AS T2 ON T1.author_id = T2.author_id GROUP BY T1.author_name ORDER BY COUNT(T2.author_id) DESC LIMIT 1
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 books published by "Harper Collins"?
SELECT T1.title FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'Harper Collins'
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 were returned in the year 2020?
SELECT COUNT(*) FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Returned' AND STRFTIME('%Y', T2.status_date) = '2020'
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 second-least common method of shipping?
SELECT T2.method_name FROM cust_order AS T1 INNER JOIN shipping_method AS T2 ON T1.shipping_method_id = T2.method_id GROUP BY T2.method_name ORDER BY COUNT(T2.method_id) ASC LIMIT 1, 1
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 of the customer addresses are inactive?
SELECT COUNT(*) FROM customer_address AS T1 INNER JOIN address_status AS T2 ON T1.status_id = T2.status_id WHERE T2.address_status = 'Inactive'
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 book with the most orders?
SELECT T2.title FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id GROUP BY T2.title ORDER BY COUNT(T1.book_id) DESC LIMIT 1
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 address that received the most orders?
SELECT T2.street_name, T2.city FROM cust_order AS T1 INNER JOIN address AS T2 ON T1.dest_address_id = T2.address_id GROUP BY T2.street_number, T2.street_name, T2.city ORDER BY COUNT(T1.dest_address_id) DESC LIMIT 1
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 much time does it take to update the status of order "2398"?
SELECT strftime('%J', T2.status_date) - strftime('%J', T1.order_date) FROM cust_order AS T1 INNER JOIN order_history AS T2 ON T1.order_id = T2.order_id WHERE T1.order_id = 2398
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 has the most addresses?
SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN customer_address AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ORDER BY COUNT(T2.customer_id) DESC LIMIT 1
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 total prices of all orders are shipped internationally?
SELECT CAST(SUM(CASE WHEN T3.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM cust_order AS T1 INNER JOIN order_line AS T2 ON T1.order_id = T2.order_id INNER JOIN shipping_method AS T3 ON T3.method_id = T1.shipping_method_id
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 authors who wrote fewer pages than the average.
SELECT T3.author_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T1.num_pages < ( SELECT AVG(num_pages) FROM book )
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)
Other than zero, what is the lowest price paid by a customer for an order?
SELECT MIN(price) FROM order_line WHERE price <> 0
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 customers have an address that is located in the city of Villeneuve-la-Garenne?
SELECT COUNT(address_id) FROM address WHERE city = 'Villeneuve-la-Garenne'
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 authors are named Adam?
SELECT COUNT(*) FROM author WHERE author_name LIKE 'Adam%'
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 customers use a Yahoo! Mail e-mail address?
SELECT COUNT(*) FROM customer WHERE email LIKE '%@yahoo.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)
What are the city addresses of the customers located in the United States of America?
SELECT DISTINCT T2.city FROM country AS T1 INNER JOIN address AS T2 ON T1.country_id = T2.country_id WHERE T1.country_name = 'United States of America'
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 did Marcelia Goering place in 2021 that uses the Priority Shipping method?
SELECT COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Marcelia' AND T1.last_name = 'Goering' AND STRFTIME('%Y', T2.order_date) = '2021' AND T3.method_name = 'Priority'
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 books have the most expensive price?
SELECT T2.title FROM order_line AS T1 INNER JOIN book AS T2 ON T1.book_id = T2.book_id ORDER BY T1.price DESC LIMIT 1
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 customers ordered the book titled "Anleitung zum Zickigsein"
SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'Anleitung zum Zickigsein'
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 most expensive price paid by a customer for the book "Bite Me If You Can (Argeneau #6)"?
SELECT MAX(T2.price) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'Bite Me If You Can (Argeneau #6)'
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 customers ordered the oldest book?
SELECT COUNT(*) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id GROUP BY T1.publication_date ORDER BY T1.publication_date ASC LIMIT 1
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 titles of the Spanish books published by Alfaguara.
SELECT T2.title FROM book_language AS T1 INNER JOIN book AS T2 ON T2.language_id = T1.language_id INNER JOIN publisher AS T3 ON T3.publisher_id = T2.publisher_id WHERE T1.language_name = 'Spanish' AND T3.publisher_name = 'Alfaguara' GROUP BY T2.title
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 customers ordered Stephen King's first book?
SELECT COUNT(T1.publication_date) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN order_line AS T4 ON T4.book_id = T1.book_id WHERE T3.author_name = 'Stephen King' ORDER BY T1.publication_date ASC LIMIT 1
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 languages of the first two published books?
SELECT T2.language_name FROM book AS T1 INNER JOIN book_language AS T2 ON T1.language_id = T2.language_id ORDER BY T1.publication_date ASC LIMIT 2
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 published the book "The Secret Garden"?
SELECT DISTINCT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T1.title = 'The Secret Garden'
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 that were published by Scholastic, how many were written by J.K Rowling?
SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id INNER JOIN book_author AS T3 ON T3.book_id = T1.book_id INNER JOIN author AS T4 ON T4.author_id = T3.author_id WHERE T2.publisher_name = 'Scholastic' AND T4.author_name = 'J.K. Rowling'
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 names of all the publishers who have published at least 30 books?
SELECT T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id GROUP BY T2.publisher_name HAVING COUNT(T2.publisher_name) >= 30
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 last number of each street.
SELECT street_number FROM address
bird