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: State the royalty percentage for the most year to date sale title within the 20000 range.
Evidence: most year to date sales refers to MAX(ytd_sales); range limit means high range which refers to hirange; the 20000 range refers to hirange<20000
SQL: SELECT MAX(T1.ytd_sales) FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange > 20000 AND T2.hirange < 20000
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 all titles published in year 1991. Also provide notes details of the title and the publisher's name.
Evidence: publisher name refers to pub_name; publication date refers to pubdate; published in year 1991 refers to YEAR(pubdate) = 1991
SQL: SELECT T1.title, T1.notes, T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE STRFTIME('%Y', T1.pubdate) = '1991'
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 all titles with sales of quantity more than 20 and store located in the CA state.
Evidence: qty is abbreviation for quantity; sales of quantity more than 20 refers to qty>20; store refers to stor_name
SQL: SELECT T1.title, T2.qty FROM titles AS T1 INNER JOIN sales AS T2 ON T1.title_id = T2.title_id INNER JOIN stores AS T3 ON T2.stor_id = T3.stor_id WHERE T2.qty > 20 AND T3.state = 'CA'
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: Name the store with the highest quantity in sales? What is the least quantity title from the store's sale?
Evidence: qty is abbreviation for quantity; highest quantity refers to MAX(qty); least quantity refers to MIN(qty)
SQL: SELECT T3.stor_id, T2.title FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id INNER JOIN stores AS T3 ON T3.stor_id = T1.stor_id WHERE T3.stor_id = ( SELECT stor_id FROM sales GROUP BY stor_id ORDER BY SUM(qty) DESC LIMIT 1 ) GROUP BY T3.stor_id, T2.title ORDER BY SUM(T1.qty) ASC 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: Name the title and publisher for title ID BU 2075. Provide all the royalty percentage for all ranges.
Evidence: name the publisher refers to pub_name
SQL: SELECT T1.title, T3.pub_name, T2.lorange, T2.hirange, T2.royalty FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id INNER JOIN publishers AS T3 ON T1.pub_id = T3.pub_id WHERE T1.title_id = 'BU2075'
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: Name the store with ID 7066 and calculate the percentage of the the quantity ordered that were on 'Net 30' payment terms.
Evidence: store with ID 7066 refers to stor_ID = '7066'; 'Net 60' payment terms refers to payterm = 'Net 60'; qty is abbreviation for quantity; percentage = DIVIDE(payterms = 'Net 60', sum(qty))*100
SQL: SELECT T2.stor_name , CAST(SUM(CASE WHEN payterms = 'Net 30' THEN qty ELSE 0 END) AS REAL) * 100 / SUM(qty) FROM sales AS T1 INNER JOIN stores AS T2 ON T1.stor_id = T2.stor_id WHERE T1.stor_id = '7066' GROUP BY T2.stor_name
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: State the publisher name for publisher ID 877? Calculate its average year to date sales.
Evidence: publisher id refers to pub_id; publisher name refers to pub_name; average year to date sales = AVG(ytd_sales)
SQL: SELECT T2.pub_name, AVG(T1.ytd_sales) FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T1.pub_id = '0877' GROUP BY T2.pub_name
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: Name all employees who were hired before year 1990.
Evidence: hired before year 1990 refers to YEAR(hire_date)<1990
SQL: SELECT fname, lname FROM employee WHERE STRFTIME('%Y', hire_date) < '1990'
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 employee has the lowest job level. State the first name, last name and when he /she was hired.
Evidence: lowest job level refers to MIN(job_lvl)
SQL: SELECT fname, lname, hire_date FROM employee ORDER BY job_lvl 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: In which year has the most hired employees?
Evidence: most hired employees refers to MAX(count(emp_id))
SQL: SELECT STRFTIME('%Y', hire_date) FROM employee GROUP BY STRFTIME('%Y', hire_date) ORDER BY COUNT(emp_id) 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: List all employees who are at the maximum level in their job designation.
Evidence: maximum level in their job designation refers to job_lvl = MAX(max_lvl)
SQL: SELECT T1.fname, T1.lname FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.job_lvl = T2.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: Name the Chief Executive Officer and when he/she was hired.
Evidence: Chief Financial Offer is a job description which refers to job_desc
SQL: SELECT T1.fname, T1.lname, T1.hire_date FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T2.job_desc = 'Chief Financial Officier'
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: Who are the employees working for publisher not located in USA? State the employee's name and publisher name.
Evidence: not located at USA refers to country! = 'USA'
SQL: SELECT T1.fname, T1.lname, T2.pub_name FROM employee AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.country != 'USA'
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 all employees working for publisher 'GGG&G'. State their name and job description.
Evidence: name = fname, lname; job description refers to job_desc; publisher refers pub_name
SQL: SELECT T1.fname, T1.lname, T3.job_desc FROM employee AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id INNER JOIN jobs AS T3 ON T1.job_id = T3.job_id WHERE T2.pub_name = 'GGG&G'
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 each publisher, state the type of titles they published order by the publisher name.
Evidence: publisher name refers to pub_name
SQL: SELECT DISTINCT T2.pub_name, T1.type FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id ORDER BY T2.pub_name
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: Name the publisher which has the most titles published in 1991.
Evidence: most title published refers to MAX(count(title_id); published in 1991 refers to YEAR(pubdate) = 1991
SQL: SELECT T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE STRFTIME('%Y', T1.pubdate) = '1991' GROUP BY T1.pub_id, T2.pub_name ORDER BY COUNT(T1.title_id) 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: Name the title with the highest price published by 'Binnet & Hardley'.
Evidence: published by refers to pub_name
SQL: SELECT T1.title FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.pub_name = 'Binnet & Hardley' ORDER BY T1.price 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: Among all employees, who have job level greater than 200. State the employee name and job description.
Evidence: job level greater than 200 refers to job_lvl>200; job description refers to job_desc
SQL: SELECT T1.fname, T1.lname, T2.job_desc FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.job_lvl > 200
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: Name all the authors for all business titles.
Evidence: business title refers to title under business where type = 'business'
SQL: SELECT T3.au_fname, T3.au_lname FROM titles AS T1 INNER JOIN titleauthor AS T2 ON T1.title_id = T2.title_id INNER JOIN authors AS T3 ON T2.au_id = T3.au_id WHERE T1.type = 'business'