1sf/bird-sql-train-with-schema huggingface dataset:
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: What is the average level employees working as Managing Editor are at? How many levels are there between the average level and the highest level?
Evidence: Managing Editor is a job description which refers to job_desc; job level refers to job_lvl; highest level job refers to max_lvl; levels between the average level and the highest level = SUBTRACT(max_lvl; AVG(job_lvl))
SQL: SELECT AVG(T2.job_lvl), T1.max_lvl - AVG(T2.job_lvl) FROM jobs AS T1 INNER JOIN employee AS T2 ON T1.job_id = T2.job_id WHERE T1.job_desc = 'Managing Editor' GROUP BY T2.job_id, T1.max_lvl
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: Which one is the cheapest business book?
Evidence: business books refers to type = 'business'; cheapest book refers to MIN(price)
SQL: SELECT title FROM titles WHERE type = 'business' ORDER BY price LIMIT 1
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: Which type of book had the most pre-paid amount?
Evidence: most pre-paid amount refers to MAX(advance)
SQL: SELECT type FROM titles ORDER BY advance DESC LIMIT 1
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: What's the royalty for the bestseller book?
Evidence: qty is abbreviation for quantity; bestseller means with the most sales quantity; MAX(qty)
SQL: SELECT royalty FROM titles ORDER BY ytd_sales DESC LIMIT 1
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: Which job level is O'Rourke at?
Evidence: job level refers to job_lvl
SQL: SELECT job_lvl FROM employee WHERE lname = 'O''Rourke'
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: Show me the employ id of the highest employee who doesn't have a middle name.
Evidence: highest employee refers to employee with the highest job level; MAX(job_lvl)
SQL: SELECT emp_id FROM employee WHERE minit = '' ORDER BY job_lvl DESC LIMIT 1
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: Is the author of "Sushi, Anyone?" on the contract?
Evidence: contract = 1 means on contract; contract = 0 means not on contract
SQL: SELECT T1.contract FROM authors AS T1 INNER JOIN titleauthor AS T2 ON T1.au_id = T2.au_id INNER JOIN titles AS T3 ON T2.title_id = T3.title_id WHERE T3.title = 'Sushi, Anyone?'
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: Which publisher had the highest job level? Give his/her full name.
Evidence: highest job level refers to MAX(job_lvl)
SQL: SELECT T1.fname, T1.minit, T1.lname FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id ORDER BY T1.job_lvl DESC LIMIT 1
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: What's Pedro S Afonso's job title?
Evidence: job title means job description which refers to job_desc
SQL: SELECT T2.job_desc FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.fname = 'Pedro' AND T1.minit = 'S' AND T1.lname = 'Afonso'
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: How many levels are there left for Diego W Roel to reach if he/she could go to the max level for his/her position?
Evidence: max level for his position refers to max_lvl; job level refers to job_lvl; level left to reach the max = SUBTRACT(max_lvl, job_lvl)
SQL: SELECT T2.max_lvl - T1.job_lvl FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.fname = 'Diego' AND T1.minit = 'W' AND T1.lname = 'Roel'
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: What's on the notes for the order happened on 1994/9/14?
Evidence: order happened on refers to ord_date
SQL: SELECT T1.notes FROM titles AS T1 INNER JOIN sales AS T2 ON T1.title_id = T2.title_id WHERE STRFTIME('%Y-%m-%d', T2.ord_date) = '1994-09-14'
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: List the type of the book for the order which was sold on 1993/5/29.
Evidence: sold on refers to ord_date
SQL: SELECT DISTINCT T1.type FROM titles AS T1 INNER JOIN sales AS T2 ON T1.title_id = T2.title_id WHERE STRFTIME('%Y-%m-%d', T2.ord_date) = '1993-05-29'
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: Tell me about the information of the French publisher.
Evidence: French publisher means publisher in France where country = 'France'
SQL: SELECT T1.pr_info FROM pub_info AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.country = 'France'
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: What's the publisher of the book "Silicon Valley Gastronomic Treats"? Give the publisher's name.
Evidence: publisher name refers to pub_name; Silicon Valley Gastronomic Treats is the title of a book
SQL: SELECT T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T1.title = 'Silicon Valley Gastronomic Treats'
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: Which city did Victoria P Ashworth work in?
SQL: SELECT T2.city FROM employee AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T1.fname = 'Victoria' AND T1.minit = 'P' AND T1.lname = 'Ashworth'
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: How many sales did the store in Remulade make?
Evidence: Remulade is a city; sales in the store refers to ord_num
SQL: SELECT COUNT(T1.ord_num) FROM sales AS T1 INNER JOIN stores AS T2 ON T1.stor_id = T2.stor_id WHERE T2.city = 'Remulade'
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: For the quantities, what percent more did the store in Fremont sell than the store in Portland in 1993?
Evidence: qty is abbreviation for quantity; Fremont and Portland are name of city; sell in 1993 refers to YEAR(ord_date) = 1993; percentage = DIVIDE(
SUBTRACT(SUM(qty where city = ‘Fremont’ and year(ord_date = 1993)), 
SUM(qty where city = ‘Portland’ and year(ord_date = 1993))), SUM(qty where city = ‘Fremont’ and year(ord_date = 1993)) *100
SQL: SELECT CAST(SUM(CASE WHEN T2.city = 'Fremont' THEN qty END) - SUM(CASE WHEN T2.city = 'Portland' THEN qty END) AS REAL) * 100 / SUM(CASE WHEN T2.city = 'Fremont' THEN qty END) FROM sales AS T1 INNER JOIN stores AS T2 ON T1.stor_id = T2.stor_id WHERE STRFTIME('%Y', T1.ord_date) = '1993'
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: Among all the employees, how many percent more for the publishers than designers?
Evidence: publisher and designer are job descriptions which refers to job_desc; percentage more = 100*(SUBTRACT(SUM(CASE WHERE job_desc = 'publisher), SUM(CASE WHERE job_desc = 'designer'))
SQL: SELECT CAST(SUM(CASE WHEN T2.job_desc = 'publisher' THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.job_desc = 'designer' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.job_id) FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id
Database: book_publishing_company
Tables: authors, jobs, publishers, employee, pub_info, stores, discounts, titles, roysched, sales, titleauthor
Columns (table index, column name): -1, *, 0, au_id, 0, au_lname, 0, au_fname, 0, phone, 0, address, 0, city, 0, state, 0, zip, 0, contract, 1, job_id, 1, job_desc, 1, min_lvl, 1, max_lvl, 2, pub_id, 2, pub_name, 2, city, 2, state, 2, country, 3, emp_id, 3, fname, 3, minit, 3, lname, 3, job_id, 3, job_lvl, 3, pub_id, 3, hire_date, 4, pub_id, 4, logo, 4, pr_info, 5, stor_id, 5, stor_name, 5, stor_address, 5, city, 5, state, 5, zip, 6, discounttype, 6, stor_id, 6, lowqty, 6, highqty, 6, discount, 7, title_id, 7, title, 7, type, 7, pub_id, 7, price, 7, advance, 7, royalty, 7, ytd_sales, 7, notes, 7, pubdate, 8, title_id, 8, lorange, 8, hirange, 8, royalty, 9, stor_id, 9, ord_num, 9, ord_date, 9, qty, 9, payterms, 9, title_id, 10, au_id, 10, title_id, 10, au_ord, 10, royaltyper
Question: Find and list the full name of employees who were hired between 1990 and 1995. Also, arrange them in the descending order of job level.
Evidence: job level refers to job_lvl; YEAR(hire_date) between 1990 and 1995
SQL: SELECT fname, minit, lname FROM employee WHERE STRFTIME('%Y', hire_date) BETWEEN '1990' AND '1995' ORDER BY job_lvl DESC