1sf/bird-sql-train-with-schema huggingface dataset:
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: In which cities are the customers of Costa Rica located?
Evidence: "Costa Rica" is the country_name
SQL: SELECT T1.city FROM address AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE T2.country_name = 'Costa Rica'
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: Which customer addresses are no longer active?
Evidence: no longer active refers to address_status = 'Inactive'; customer address refers to street_number, street_name, city
SQL: SELECT DISTINCT T1.street_name FROM address AS T1 INNER JOIN customer_address AS T2 ON T1.address_id = T2.address_id INNER JOIN address_status AS T3 ON T3.status_id = T2.status_id WHERE T3.address_status = 'Inactive'
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: What is the full name of the customers who live in Baiyin city?
Evidence: full name refers to first_name, last_name; 'Baiyin' is the city
SQL: SELECT T3.first_name, T3.last_name FROM address AS T1 INNER JOIN customer_address AS T2 ON T1.address_id = T2.address_id INNER JOIN customer AS T3 ON T3.customer_id = T2.customer_id WHERE T1.city = 'Baiyin'
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: What is the email of the customers who place their orders with priority method?
Evidence: priority method refers to method_name = 'Priority'
SQL: SELECT T1.email FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T3.method_name = 'Priority'
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: On what date did the customers who live at number 460 of their respective streets place their orders?
Evidence: live at number 460 refers to street_number = '460'; date the customers placed their orders refers to order_date
SQL: SELECT T1.order_date FROM cust_order AS T1 INNER JOIN address AS T2 ON T1.dest_address_id = T2.address_id WHERE T2.street_number = 460
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: Identify by their id all the orders that have been cancelled.
Evidence: have been cancelled refers to status_value = 'cancelled'; id refers to order_id
SQL: SELECT T2.order_id FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id WHERE T1.status_value = 'Cancelled'
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: What is the status of the orders placed on 04/10/2022?
Evidence: placed on 04/10/2022 refers to SUBSTR(order_date, 1, 10) = '2022-04-10'; status of order refers to status_value
SQL: SELECT DISTINCT T1.status_value FROM order_status AS T1 INNER JOIN order_history AS T2 ON T1.status_id = T2.status_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id WHERE T3.order_date LIKE '2022-04-10%'
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: What is the highest price at which a customer bought the book 'The Prophet'?
Evidence: "The Prophet" is the title of the book; highest price refers to Max(price)
SQL: SELECT MAX(T2.price) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id WHERE T1.title = 'The Prophet'
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: On what dates were books ordered at a price of 16.54?
Evidence: price of 16.54 refers to price = 16.54; dates the book ordered refers to order_date
SQL: SELECT T1.order_date FROM cust_order AS T1 INNER JOIN order_line AS T2 ON T1.order_id = T2.order_id WHERE T2.price = 16.54
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: List the titles of all the books that Peter H. Smith wrote.
Evidence: "Peter H.Smit" is the author_name
SQL: SELECT T1.title FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Peter H. Smith'
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: How many books under 300 pages has HarperCollins Publishers published?
Evidence: under 300 pages refers to num_pages < 300; 'HarperCollins Publishers" is the publisher_name
SQL: SELECT COUNT(*) FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE T2.publisher_name = 'HarperCollins Publishers' AND T1.num_pages < 300
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: How many books have been published in Japanese?
Evidence: in Japanese refers to language_name = 'Japanese
SQL: SELECT COUNT(*) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id WHERE T1.language_name = 'Japanese'
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: What is the average number of pages in the books written by Jennifer Crusie?
Evidence: "Jennifer Crusie" is the author_name; average number of pages refers to AVG(num_pages)
SQL: SELECT AVG(T1.num_pages) FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id WHERE T3.author_name = 'Jennifer Crusie'
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: What percentage of the orders placed by Kaleena were shipped by the international method?
Evidence: shipped by international method refers to method_name = 'International'; percentage = Divide (Sum(method_name = 'International'), Count(method_name)) * 100
SQL: SELECT CAST(SUM(CASE WHEN T3.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Kaleena'
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: Provide the full name of the customers who have ordered the book The Sorrows of Young Werther.
Evidence: full name refers to first_name, last_name; 'The Sorrows of Young Werther' is the title of the book
SQL: SELECT T4.first_name, T4.last_name FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T1.title = 'The Sorrows of Young Werther'
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: List every book that Ursola Purdy has ordered.
Evidence: book refers to title
SQL: SELECT T1.title FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Ursola' AND T4.last_name = 'Purdy'
Database: books
Tables: address_status, author, book_language, country, address, customer, customer_address, order_status, publisher, book, book_author, shipping_method, cust_order, order_history, order_line
Columns (table index, column name): -1, *, 0, status_id, 0, address_status, 1, author_id, 1, author_name, 2, language_id, 2, language_code, 2, language_name, 3, country_id, 3, country_name, 4, address_id, 4, street_number, 4, street_name, 4, city, 4, country_id, 5, customer_id, 5, first_name, 5, last_name, 5, email, 6, customer_id, 6, address_id, 6, status_id, 7, status_id, 7, status_value, 8, publisher_id, 8, publisher_name, 9, book_id, 9, title, 9, isbn13, 9, language_id, 9, num_pages, 9, publication_date, 9, publisher_id, 10, book_id, 10, author_id, 11, method_id, 11, method_name, 11, cost, 12, order_id, 12, order_date, 12, customer_id, 12, shipping_method_id, 12, dest_address_id, 13, history_id, 13, order_id, 13, status_id, 13, status_date, 14, line_id, 14, order_id, 14, book_id, 14, price
Question: Who is the author of the book with the biggest page count?
Evidence: author refers to author_name, biggest page count refers to Max(num_pages)
SQL: 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