Chinastark/bird_dataset huggingface dataset:
Database: books
Note: "Akira Watanabe" is the author_name;
Question: How many books written by Akira Watanabe are available on Gravity?
SQL: SELECT count(*) FROM author INNER JOIN book_author ON author.author_id = book_author.author_id WHERE author.author_name = 'Akira Watanabe'
Database: books
Note: full address refers to street_number, street_name, city, country_name;
Question: Provide the full address of Ursola Purdy.
SQL: SELECT address.street_number, address.street_name, address.city FROM customer INNER JOIN customer_address ON customer.customer_id = customer_address.customer_id INNER JOIN address ON address.address_id = customer_address.address_id INNER JOIN country ON country.country_id = address.country_id WHERE customer.first_name = 'Ursola' AND customer.last_name = 'Purdy'
Database: books
Note: author refers to author_name; 'The Mystery in the Rocky Mountains' is the title of the book;
Question: Who is the author of the book The Mystery in the Rocky Mountains?
SQL: SELECT author.author_name FROM book INNER JOIN book_author ON book.book_id = book_author.book_id INNER JOIN author ON author.author_id = book_author.author_id WHERE book.title = 'The Mystery in the Rocky Mountains'
Database: books
Note: "Girls' Night In" is the title of the book; publisher is the publisher_name;
Question: Identify the publisher of the book Girls' Night In.
SQL: SELECT publisher.publisher_name FROM book INNER JOIN publisher ON book.publisher_id = publisher.publisher_id WHERE book.title = 'Girls'' Night In'
Database: books
Note: publisher refers to publisher_name;  oldest book refers to Min(publication_date);
Question: Name the publisher of the oldest book.
SQL: SELECT publisher.publisher_name FROM book INNER JOIN publisher ON book.publisher_id = publisher.publisher_id ORDER BY book.publication_date ASC LIMIT 1
Database: books
Note: "Priority" and "Express" are both method_name; cost difference = Subtract (Sum(cost where method_name = 'Express'), Sum(cost where method_name 'Priority'));
Question: Identify the cost difference between Priority and Express shipping methods.
SQL: SELECT sum(CASE WHEN method_name = 'Priority' THEN cost ELSE 0 END) - sum(CASE WHEN method_name = 'Express' THEN cost ELSE 0 END) FROM shipping_method
Database: books
Note: cancelled refers to status_value = 'Cancelled'; in 2022 refers to SUBSTR(status_date, 1, 4) = '2022';
Question: How many orders have been cancelled in 2022?
SQL: SELECT count(*) FROM order_status INNER JOIN order_history ON order_status.status_id = order_history.status_id WHERE order_status.status_value = 'Cancelled' AND strftime('%Y', order_history.status_date) = '2022'
Database: books
Note: "BBC Audiobooks" refers to publisher_name; books refers to title;
Question: List all the books published by BBC Audiobooks.
SQL: SELECT book.title FROM book INNER JOIN publisher ON book.publisher_id = publisher.publisher_id WHERE publisher.publisher_name = 'BBC Audiobooks'
Database: books
Note: published in 2017 refers to Substr(publication_date,1, 4) = '2017';
Question: How many books were published in 2017?
SQL: SELECT count(*) FROM book WHERE strftime('%Y', publication_date) = '2017'
Database: books
Note: International Standard book Number refers to isbn13; 'The Mystery in the Rocky Mountains' is the title of the book;
Question: Provide the International Standard Book Number of the book The Mystery in the Rocky Mountains.
SQL: SELECT isbn13 FROM book WHERE title = 'The Mystery in the Rocky Mountains'
Database: books
Note: order updated in 2022 refers to SUBSTR(status_date, 1, 4) = '2022'; has been returned refers to status_value = 'Returned'; percentage = Divide (Count(status_value = 'Returned'), Count(status_value)) * 100;
Question: Among all orders updated in 2022, identify the percentage that has been returned.
SQL: SELECT cast(sum(CASE WHEN order_status.status_value = 'Returned' THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM order_status INNER JOIN order_history ON order_status.status_id = order_history.status_id WHERE strftime('%Y', order_history.status_date) = '2022'
Database: books
Note: address not in use refers to address_status = 'Inactive'; percentage = Divide (Count(address_status = 'Inactive'), Count(address_status)) * 100;
Question: Among all addresses provided by customers, identify the percentage that are not in use anymore.
SQL: SELECT cast(sum(CASE WHEN address_status.address_status = 'Inactive' THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM customer_address INNER JOIN address_status ON address_status.status_id = customer_address.status_id
Database: books
Note: "Seaward" is the title of the book; pages refers to num_pages;
Question: How many pages does 'Seaward' have?
SQL: SELECT num_pages FROM book WHERE title = 'Seaward'
Database: books
Note: "First Things First" is the title of the book; author refers to author_name;
Question: Who is the author of First Things First?
SQL: SELECT author.author_name FROM book INNER JOIN book_author ON book.book_id = book_author.book_id INNER JOIN author ON author.author_id = book_author.author_id WHERE book.title = 'First Things First'
Database: books
Note: "Tom Clancy" is the author_name; books refers title;
Question: List all books authored by Tom Clancy.
SQL: SELECT book.title FROM book INNER JOIN book_author ON book.book_id = book_author.book_id INNER JOIN author ON author.author_id = book_author.author_id WHERE author.author_name = 'Tom Clancy'
Database: books
Note: "Hirohiko Araki" is the author_name; on 6/6/2006 refers to publication_date = '2006-06-06'; which book refers to title;
Question: Which book by Hirohiko Araki was published on 6/6/2006?
SQL: SELECT book.title FROM book INNER JOIN book_author ON book.book_id = book_author.book_id INNER JOIN author ON author.author_id = book_author.author_id WHERE author.author_name = 'Hirohiko Araki' AND book.publication_date = '2006-06-06'
Database: books
Note: "Hitchhiker's Guide To The Galaxy: The Filming of the Douglas Adams classic" is the title of the book; publisher refers to publisher_name;
Question: Who is the publisher of Hitchhiker's Guide To The Galaxy: The Filming of the Douglas Adams classic?
SQL: SELECT publisher.publisher_name FROM book INNER JOIN publisher ON book.publisher_id = publisher.publisher_id WHERE book.title = 'Hitchhiker''s Guide To The Galaxy: The Filming of the Douglas Adams classic'
Database: books
Note: "ADV Manga" is the publisher_name; books refers to title;
Question: List all books published by ADV Manga.
SQL: SELECT book.title FROM book INNER JOIN publisher ON book.publisher_id = publisher.publisher_id WHERE publisher.publisher_name = 'ADV Manga'
Database: books
Note: full name refers to first_name, last_name; '55' is the street_number, 'Dorton Pass' is the street_name; 'Huangqiao' is the city;
Question: Write the full name of the customers whose address is at 55 Dorton Pass, Huangqiao.
SQL: SELECT DISTINCT customer.first_name, customer.last_name FROM customer INNER JOIN customer_address ON customer.customer_id = customer_address.customer_id INNER JOIN address ON address.address_id = customer_address.address_id WHERE address.street_number = 55 AND address.street_name = 'Dorton Pass' AND address.city = 'Huangqiao'
Database: books
Note: "9" is the street_number; 'Green Reidge Point' is the street_name; 'Arendal' is the city;
Question: Which country is 9 Green Ridge Point, Arendal located at?
SQL: SELECT country.country_name FROM address INNER JOIN country ON country.country_id = address.country_id WHERE address.street_number = 9 AND address.street_name = 'Green Ridge Point' AND address.city = 'Arendal'
Database: books
Note: "Polan" is the country_name; address refers to street_number, street_name, city;
Question: List 10 addresses located in Poland.
SQL: SELECT address.street_number, address.street_name, address.city FROM address INNER JOIN country ON country.country_id = address.country_id WHERE country.country_name = 'Poland' LIMIT 10
Database: books
Note: ordered at 6/29/2020 7:40:07 PM refers to order_date = '2020-06-29 19:40:07'; shipping method refers to method_name;
Question: What is the shipping method ordered by Nicolette Sadler at 6/29/2020 7:40:07 PM?
SQL: SELECT shipping_method.method_name FROM cust_order INNER JOIN customer ON cust_order.customer_id = customer.customer_id INNER JOIN shipping_method ON shipping_method.method_id = cust_order.shipping_method_id WHERE customer.first_name = 'Nicolette' AND customer.last_name = 'Sadler' AND cust_order.order_date = '2020-06-29 19:40:07'
Database: books
Note: "Arabic" is the language_name; book refers to title;
Question: List all books written in Arabic.
SQL: SELECT book.title FROM book INNER JOIN book_language ON book.language_id = book_language.language_id WHERE book_language.language_name = 'Arabic'
Database: books
Note: "El plan infinito" is the title of the book; language refers to language_name;
Question: Which language is 'El plan infinito' written in?
SQL: SELECT book_language.language_name FROM book INNER JOIN book_language ON book.language_id = book_language.language_id WHERE book.title = 'El plan infinito'
Database: books
Note: "Hirohiko Araki" is the author_name; 'Viz Media' is the publisher_name; percentage = Divide (Count(author_name = 'Hirohiko Araki'), Count(book_id)) * 100;
Question: What percentage of books written by Hirohiko make up the number of books published by Viz Media?
SQL: SELECT cast(sum(CASE WHEN author.author_name = 'Hirohiko Araki' THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM author INNER JOIN book_author ON book_author.author_id = author.author_id INNER JOIN book ON book.book_id = book_author.book_id INNER JOIN publisher ON publisher.publisher_id = book.publisher_id WHERE publisher.publisher_name = 'VIZ Media'
Database: books
Note: "Zilpha Keatley Snyder" is the author_name; average number of book pages refers to AVG(num_pages);
Question: What is the average number of book pages written by Zilpha Keatley Snyder?
SQL: SELECT avg(book.num_pages) FROM book_author INNER JOIN author ON book_author.author_id = author.author_id INNER JOIN book ON book.book_id = book_author.book_id WHERE author.author_name = 'Zilpha Keatley Snyder'
Database: books
Note: "ckupis4@tamu.edu" is the email of customer; full name refers to first_name, last_name;
Question: What is the full name of customer with email ckupis4@tamu.edu?
SQL: SELECT first_name, last_name FROM customer WHERE email = 'ckupis4@tamu.edu'
Database: books
Note: books with the most number of pages refers to Max(num_pages);
Question: Which book has the most number of pages?
SQL: SELECT title FROM book ORDER BY num_pages DESC LIMIT 1
Database: books
Note: "A.J. Ayer" is the author_name;
Question: How many books were written by author A.J. Ayer?
SQL: SELECT count(*) FROM book_author INNER JOIN author ON book_author.author_id = author.author_id WHERE author.author_name = 'A.J. Ayer'
Database: books
Note: "A.J. Ayer" is the author_name;
Question: Name the title of books written by author A.J.Ayer.
SQL: SELECT book.title FROM book_author INNER JOIN author ON book_author.author_id = author.author_id INNER JOIN book ON book.book_id = book_author.book_id WHERE author.author_name = 'A.J. Ayer'
Database: books
Note: "The Season: A Candid Look at Broadway" is the  title of the book; publisher refers to publisher_name;
Question: The book name "The Season: A Candid Look at Broadway" was published by which publisher?
SQL: SELECT publisher.publisher_name FROM book INNER JOIN publisher ON book.publisher_id = publisher.publisher_id WHERE book.title = 'The Season: A Candid Look at Broadway'
Database: books
Note: English book refers to language_name = 'English'; 'Carole Marsh Mysteries' is the publisher_name; average = Divide (Count(language_name = 'English'), Count(book_id));
Question: What is the average of English books among all books published by Carole Marsh Mysteries?
SQL: SELECT cast(sum(CASE WHEN book_language.language_name = 'English' THEN 1 ELSE 0 END) AS REAL) / count(*) FROM book_language INNER JOIN book ON book_language.language_id = book.language_id INNER JOIN publisher ON publisher.publisher_id = book.publisher_id WHERE publisher.publisher_name = 'Carole Marsh Mysteries'
Database: books
Note: books with the most number of pages refers to Max(num_pages); published from 1990 to 2000 refers to SUBSTR(publication_date, 1, 4) BETWEEN '1990' AND '2000'; 'Free Press' is the publisher_name;
Question: Name the title of the book with the most number of pages that was published from 1990 to 2000 by publisher Free Press.
SQL: SELECT book.title FROM book INNER JOIN publisher ON book.publisher_id = publisher.publisher_id WHERE publisher.publisher_name = 'Free Press' AND strftime('%Y', book.publication_date) BETWEEN '1990' AND '2000' ORDER BY book.num_pages DESC LIMIT 1
Database: books
Note: "The Servant Leader" is the title of the book; book in 2003 refers to SUBSTR(publication_date, 1, 4) = '2003';
Question: What is the order price of the book "The Servant Leader" in 2003?
SQL: SELECT order_line.price FROM book INNER JOIN order_line ON book.book_id = order_line.book_id WHERE book.title = 'The Servant Leader' AND strftime('%Y', book.publication_date) = '2003'
Database: books
Note: current address refers to address_status = 1; address refers to street_number, street_name, city;
Question: What is the current address of customer Kandy?
SQL: SELECT address.street_number, address.street_name, address.city FROM customer INNER JOIN customer_address ON customer.customer_id = customer_address.customer_id INNER JOIN address ON address.address_id = customer_address.address_id INNER JOIN address_status ON address_status.status_id = customer_address.status_id WHERE customer.first_name = 'Kandy'
Database: books
Question: How many books were ordered by customer Kandy Adamec?
SQL: SELECT count(*) FROM order_line INNER JOIN cust_order ON cust_order.order_id = order_line.order_id INNER JOIN customer ON customer.customer_id = cust_order.customer_id WHERE customer.first_name = 'Kandy' AND customer.last_name = 'Adamec'
Database: books
Note: orders got returned refers to status_value = 'Returned'; in 2022 refers to SUBSTR(status_date, 1, 4) = '2022';
Question: How many orders got returned in 2022?
SQL: SELECT count(*) FROM order_status INNER JOIN order_history ON order_status.status_id = order_history.status_id WHERE order_status.status_value = 'Returned' AND strftime('%Y', order_history.status_date) = '2022'
Database: books
Note: "rturbitt2@geocities.jp" is the email of customer; country refers to country_name;
Question: Which country does the customer with the email "rturbitt2@geocities.jp" from?
SQL: SELECT country.country_name FROM customer INNER JOIN customer_address ON customer.customer_id = customer_address.customer_id INNER JOIN address ON address.address_id = customer_address.address_id INNER JOIN country ON country.country_id = address.country_id WHERE customer.email = 'rturbitT2@geocities.jp'
Database: books
Note: published the most books refers to Max(Count(book_id)); publisher refers to publisher_name;
Question: Name the publisher who published the most books.
SQL: SELECT publisher.publisher_name FROM book INNER JOIN publisher ON book.publisher_id = publisher.publisher_id GROUP BY publisher.publisher_name ORDER BY count(publisher.publisher_id) DESC LIMIT 1
Database: books
Note: "A.J. Ayer" is the author_name; first book refers to Min(publication_date);
Question: What is the title of the first book that was written by A.J. Ayer?
SQL: SELECT book.title FROM book INNER JOIN book_author ON book.book_id = book_author.book_id INNER JOIN author ON author.author_id = book_author.author_id WHERE author.author_name = 'A.J. Ayer' ORDER BY book.publication_date ASC LIMIT 1
Database: books
Note: cost greater than $10 refers to price > 10; percentage = Divide (Count(book_id where price >10), Count(book_id)) * 100; full name refers to the composition of first name, lastname;
Question: What is the percentage of books that cost greater than $10 and were ordered by customer Ruthanne Vatini?
SQL: SELECT cast(sum(CASE WHEN order_line.price > 10 THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM order_line INNER JOIN cust_order ON cust_order.order_id = order_line.order_id INNER JOIN customer ON customer.customer_id = cust_order.customer_id WHERE customer.first_name = 'Ruthanne' AND customer.last_name = 'Vatini'
Database: books
Note: "AK Press" is the publisher_name;
Question: List the title of books published by AK Press.
SQL: SELECT book.title FROM book INNER JOIN publisher ON book.publisher_id = publisher.publisher_id WHERE publisher.publisher_name = 'AK Press'
Database: books
Note: book with cheapest price refers to Min(price); who order means name of customer which refers to first_name, last_name;
Question: Who ordered the book with the cheapest price?
SQL: SELECT customer.first_name, customer.last_name FROM order_line INNER JOIN cust_order ON cust_order.order_id = order_line.order_id INNER JOIN customer ON customer.customer_id = cust_order.customer_id ORDER BY order_line.price ASC LIMIT 1
Database: books
Note: "fsier3e@ihg.com" is the email of customer; ISBN refers to isbn13;
Question: List down the ISBN of the books purchased by the customer with an email of fsier3e@ihg.com.
SQL: SELECT book.isbn13 FROM book INNER JOIN order_line ON book.book_id = order_line.book_id INNER JOIN cust_order ON cust_order.order_id = order_line.order_id INNER JOIN customer ON customer.customer_id = cust_order.customer_id WHERE customer.email = 'fsier3e@ihg.com'
Database: books
Note: books cost 19 dollars and above refers to price >= 19;
Question: Give the author's name of the books that cost 19 dollars and above.
SQL: SELECT DISTINCT author.author_name FROM book INNER JOIN book_author ON book.book_id = book_author.book_id INNER JOIN author ON author.author_id = book_author.author_id INNER JOIN order_line ON order_line.book_id = book.book_id WHERE order_line.price > 19
Database: books
Note: "76092025986" is the isbn13;
Question: Provide the publisher name of the book with ISBN 76092025986.
SQL: SELECT publisher.publisher_name FROM book INNER JOIN publisher ON book.publisher_id = publisher.publisher_id WHERE book.isbn13 = 76092025986
Database: books
Note: "Birlinn" is the publisher_name; books have pages around 600 to 700 refers to num_pages BETWEEN 600 AND 700; in 2008 refers to SUBSTR(publication_date, 1, 4) = '2008';
Question: Among the books published by Birlinn in 2008, how many books have pages around 600 to 700?
SQL: SELECT count(*) FROM book INNER JOIN publisher ON book.publisher_id = publisher.publisher_id WHERE publisher.publisher_name = 'Birlinn' AND strftime('%Y', book.publication_date) = '2008' AND book.num_pages BETWEEN 600 AND 700
Database: books
Note: "9780763628321" is the isbn13;
Question: What is the price of the book with ISBN 9780763628321?
SQL: SELECT order_line.price FROM book INNER JOIN order_line ON book.book_id = order_line.book_id WHERE book.isbn13 = 9780763628321
Database: books
Note: number of pages refers to num_pages;
Question: What is the number of pages of the book in the order ID 1167?
SQL: SELECT book.num_pages FROM book INNER JOIN order_line ON book.book_id = order_line.book_id WHERE order_line.order_id = 1167
Database: books
Note: "British English" is the language_name of the book;
Question: Provide the title of the books published in British-English.
SQL: SELECT DISTINCT book.title FROM book INNER JOIN book_language ON book.language_id = book_language.language_id WHERE book_language.language_name = 'British English'
Database: books
Note: "Brava" is the publisher_name; in 2006 refers to SUBSTR(publication_date, 1, 4) = '2006';
Question: How many books were published by Brava in 2006?
SQL: SELECT count(*) FROM book INNER JOIN publisher ON book.publisher_id = publisher.publisher_id WHERE publisher.publisher_name = 'Brava' AND strftime('%Y', book.publication_date) = '2006'
Database: books
Note: ISBN refers to isbn13;
Question: Provide the ISBN and price of the book with book ID 7160.
SQL: SELECT book.isbn13, order_line.price FROM book INNER JOIN order_line ON book.book_id = order_line.book_id WHERE order_line.book_id = 6503
Database: books
Question: What is the title of the book in the order ID 931?
SQL: SELECT book.title FROM book INNER JOIN order_line ON book.book_id = order_line.book_id WHERE order_line.order_id = 931
Database: books
Note: "Zorro" is the title of the book; langauge refers to language_name;
Question: What is the language of the book titled Zorro?
SQL: SELECT book_language.language_name FROM book INNER JOIN book_language ON book.language_id = book_language.language_id WHERE book.title = 'Zorro'
Database: books
Note: books with a price range of 3 to 5 dollars refers to price BETWEEN 3 AND 5;
Question: Provide the email of the customers that purchased books with a price range of 3 to 5 dollars.
SQL: SELECT DISTINCT customer.email FROM order_line INNER JOIN cust_order ON cust_order.order_id = order_line.order_id INNER JOIN customer ON customer.customer_id = cust_order.customer_id WHERE order_line.price BETWEEN 3 AND 5
Database: books
Note: ISBN refers to isbn13; books cost 7.5 dollars refers to price = 7.5;
Question: List the ISBN of the books that cost 7.5 dollars.
SQL: SELECT book.isbn13 FROM book INNER JOIN order_line ON book.book_id = order_line.book_id WHERE order_line.price = 7.5
Database: books
Note: "Alan Lee" is the author_name; publisher's name refers to publisher_name;
Question: Give the publisher's name of the books authored by Alan Lee.
SQL: SELECT publisher.publisher_name FROM book INNER JOIN book_author ON book.book_id = book_author.book_id INNER JOIN author ON author.author_id = book_author.author_id INNER JOIN publisher ON publisher.publisher_id = book.publisher_id WHERE author.author_name = 'Alan Lee' GROUP BY publisher.publisher_name
Database: books
Note: sum of the number of pages refers to Sum(num_pages);
Question: What is the sum of the number of pages of the books ordered by Mick Sever?
SQL: SELECT sum(book.num_pages) FROM book INNER JOIN order_line ON book.book_id = order_line.book_id INNER JOIN cust_order ON cust_order.order_id = order_line.order_id INNER JOIN customer ON customer.customer_id = cust_order.customer_id WHERE customer.first_name = 'Mick' AND customer.last_name = 'Sever'
Database: books
Note: author's name refers to author_name; book most recently published refers to Max(publication_date);
Question: Write down the author's name of the book most recently published.
SQL: SELECT author.author_name FROM book INNER JOIN book_author ON book.book_id = book_author.book_id INNER JOIN author ON author.author_id = book_author.author_id ORDER BY book.publication_date DESC LIMIT 1
Database: books
Note: "Ace book" is the publisher_name; English book refers to language_name = 'English'; percentage = Divide (Count(book_id where language_name = 'English'), Count(book_id)) * 100;
Question: In books published by Ace Book, what is the percentage of English books published?
SQL: SELECT cast(sum(CASE WHEN book_language.language_name = 'English' THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM book_language INNER JOIN book ON book_language.language_id = book.language_id INNER JOIN publisher ON publisher.publisher_id = book.publisher_id WHERE publisher.publisher_name = 'Ace Book'
Database: books
Note: book purchased by less than 1 dollar refers to price < 1; books with less than 500 pages refers to num_pages < 500; greater than 500 pages refers to num_pages > 500; Difference = Subtract (Count(book_id where num_pages < 500), Count(book_id where num_pages > 500));
Question: Among the books purchased by less than 1 dollar, what is the difference between the number of books with less than 500 pages and books with greater than 500 pages?
SQL: SELECT sum(CASE WHEN book.num_pages < 500 THEN 1 ELSE 0 END) - sum(CASE WHEN book.num_pages > 500 THEN 1 ELSE 0 END) AS dif FROM book INNER JOIN order_line ON book.book_id = order_line.book_id WHERE order_line.price < 1