Chinastark/bird_dataset huggingface dataset:
Database: book_publishing_company
Question: What is the title that have at least 10% royalty without minimum range amount.
Evidence: at least 10% royalty refers to royalty > = 10; minimum range is synonym for low range which refers to lorange; without minimum range amount refers to lorange <> 0
SQL: SELECT T1.title FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange = 0 AND T2.royalty >= 10
Database: book_publishing_company
Question: State the title and royalty percentage for title ID BU2075 between 10000 to 50000 range.
Evidence: lorange mean low range; hirange mean high range; range refers to between the low and high range; lorange>10000; hirange<12000
SQL: SELECT T1.title, T2.royalty FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange > 10000 AND T2.hirange < 50000 AND T1.title_ID = 'BU2075'
Database: book_publishing_company
Question: Among the titles with royalty percentage, which title has the greatest royalty percentage. State it's minimum range to enjoy this royalty percentage.
Evidence: minimum range is synonym for low range which refers to lorange
SQL: SELECT T1.title, T2.lorange FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id ORDER BY T2.royalty DESC LIMIT 1
Database: book_publishing_company
Question: Provide a list of titles together with its publisher name for all publishers located in the USA.
Evidence: publisher name refers to pub_name;
SQL: SELECT T1.title, T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.country = 'USA'
Database: book_publishing_company
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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'
Database: book_publishing_company
Question: List all the titles and year to date sales by author who are not on contract.
Evidence: year to date sales refers to ytd_sales; not on contract refers to contract = 0
SQL: SELECT T1.title_id, T1.ytd_sales 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 T3.contract = 0
Database: book_publishing_company
Question: For all authors from CA who are not on contract, which title of his/hers has the most year to date sales.
Evidence: year to date sales refers to ytd_sales; on contract refers to contract = 1
SQL: SELECT T1.title 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 T3.contract = 0 AND T3.state = 'CA' ORDER BY T1.ytd_sales DESC LIMIT 1
Database: book_publishing_company
Question: Name all the authors for 'Sushi, Anyone?'.
Evidence: most year to date sales refers to MAX(ytd_sales); on contract refers to contract = 1; name of author = au_fname, au_lname
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.title = 'Sushi, Anyone?'
Database: book_publishing_company
Question: Calculate the percentage of the employees who are Editor or Designer?
Evidence: Editor or Auditor are job description which refers to job_desc; percentage = DIVIDE(count(job_desc = 'Editor' or job_desc = 'Auditor'), count(emp_id))*100
SQL: SELECT CAST(SUM(CASE WHEN T2.job_desc IN ('Editor', '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
Question: List all titles which have year to date sales higher than the average order by pubisher name.
Evidence: year to date sales refers to ytd_sales; average order = AVG(ytd_sales)
SQL: SELECT T1.title FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T1.ytd_sales > ( SELECT AVG(ytd_sales) FROM titles )
Database: book_publishing_company
Question: How many publishers are in the USA?
SQL: SELECT COUNT(pub_id) FROM publishers WHERE country = 'USA'
Database: book_publishing_company
Question: What is the publisher's information of New Moon Books?
Evidence: publisher name refers to pub_name; New Moon Books is a publisher name
SQL: SELECT T1.pr_info FROM pub_info AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.pub_name = 'New Moon Books'
Database: book_publishing_company
Question: Please list the first names of the employees who work as Managing Editor.
Evidence: Managing Editor is a job description which refers to job_desc
SQL: SELECT T1.fname FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T2.job_desc = 'Managing Editor'
Database: book_publishing_company
Question: What is the highest level of job to get to for the employee who got hired the earliest?
Evidence: highest job level refers to MAX(job_lvl); hired the earliest refers to MIN(hire_date)
SQL: SELECT T2.max_lvl FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id ORDER BY T1.hire_date LIMIT 1
Database: book_publishing_company
Question: In which city is the store with the highest total sales quantity located?
Evidence: qty is abbreviation for quantity; highest sales quantity refers to MAX(qty)
SQL: SELECT T2.city FROM sales AS T1 INNER JOIN stores AS T2 ON T1.stor_id = T2.stor_id GROUP BY T2.city ORDER BY SUM(T1.qty) DESC LIMIT 1
Database: book_publishing_company
Question: What is the price of the book that sells the best?
Evidence: qty is abbreviation for quantity; sells the best mean with the most sales quantity; MAX(qty)
SQL: SELECT T2.price FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id ORDER BY T1.qty DESC LIMIT 1
Database: book_publishing_company
Question: Please list the stores that ordered the book "Life Without Fear".
Evidence: store name refers to stor_name
SQL: SELECT T2.stor_name FROM sales AS T1 INNER JOIN stores AS T2 ON T1.stor_id = T2.stor_id INNER JOIN titles AS T3 ON T1.title_id = T3.title_id WHERE T3.title = 'Life Without Fear'
Database: book_publishing_company
Question: Among the stores that have ordered the book "Life Without Fear", how many of them are located in Massachusetts?
Evidence: Massachusetts is a state
SQL: SELECT COUNT(T1.stor_id) FROM sales AS T1 INNER JOIN stores AS T2 ON T1.stor_id = T2.stor_id INNER JOIN titles AS T3 ON T1.title_id = T3.title_id WHERE T2.state = 'Massachusetts'
Database: book_publishing_company
Question: In which country is the publisher of the book "Life Without Fear" located?
Evidence: Life Without Fear is book title
SQL: SELECT T2.country FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T1.title = 'Life Without Fear'
Database: book_publishing_company
Question: What is the publisher that has published the most expensive book?
Evidence: most expensive book refers to MAX(price)
SQL: SELECT T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id ORDER BY T1.price DESC LIMIT 1
Database: book_publishing_company
Question: Among the publishers in the USA, how many of them have published books that are over $15?
Evidence: are over $15 refers to price>15
SQL: SELECT COUNT(DISTINCT T1.pub_id) FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.country = 'USA' AND T1.price > 15
Database: book_publishing_company
Question: Please give more detailed information about the first three books that sell the best.
Evidence: qty is abbreviation for quantity; sells the best mean with the most sales quantity; MAX(qty)
SQL: SELECT T1.notes FROM titles AS T1 INNER JOIN sales AS T2 ON T1.title_id = T2.title_id ORDER BY T2.qty DESC LIMIT 3
Database: book_publishing_company
Question: How many books on business have the bookstores in Massachusetts ordered?
Evidence: Massachusetts is a state; business books refers to type = 'business'
SQL: SELECT SUM(T1.qty) FROM sales AS T1 INNER JOIN stores AS T2 ON T1.stor_id = T2.stor_id INNER JOIN titles AS T3 ON T1.title_id = T3.title_id WHERE T2.state = 'Massachusetts' AND T3.type = 'business'
Database: book_publishing_company
Question: What is the average quantity of each order for the book "Life Without Fear"?
Evidence: qty is abbreviation for quantity; average quantity order = AVG(qty)
SQL: SELECT CAST(SUM(T2.qty) AS REAL) / COUNT(T1.title_id) FROM titles AS T1 INNER JOIN sales AS T2 ON T1.title_id = T2.title_id WHERE T1.title = 'Life Without Fear'
Database: book_publishing_company
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Database: book_publishing_company
Question: Which titles has above average royalty rate? Give those title's name, type and price?
Evidence: average royalty rate = DIVIDE(SUM(royalty), COUNT(title_id))
SQL: SELECT DISTINCT T1.title, T1.type, T1.price FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.royalty > ( SELECT CAST(SUM(royalty) AS REAL) / COUNT(title_id) FROM roysched )
Database: book_publishing_company
Question: In 1994 which title had less order quanty than the average order quantity? Find the title name, type and price.
Evidence: orders in 1994 refers to YEAR(ord_date) = 1994; order quantity refers to number of order expressed by ord_num; average order quantity = DIVIDE(SUM(ord_num), COUNT(title_id))
SQL: SELECT DISTINCT T1.title, T1.type, T1.price FROM titles AS T1 INNER JOIN sales AS T2 ON T1.title_id = T2.title_id WHERE T2.ord_date LIKE '1994%' AND T2.Qty < ( SELECT CAST(SUM(T4.qty) AS REAL) / COUNT(T3.title_id) FROM titles AS T3 INNER JOIN sales AS T4 ON T3.title_id = T4.title_id )
Database: book_publishing_company
Question: List the title name, type, and price of the titles published by New Moon Books. Arrange the list in ascending order of price.
Evidence: Eric the Read Books is a publisher which refers to pub_name;
SQL: SELECT T1.title, T1.type, T1.price FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.pub_name = 'New Moon Books' ORDER BY T1.price
Database: book_publishing_company
Question: In the books published by US publishers, which book has the highest royalty? List these books in the descending order of royalty.
Evidence: US publisher refers publisher in the US where country = 'USA';
SQL: SELECT T1.title FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id INNER JOIN roysched AS T3 ON T1.title_id = T3.title_id WHERE T2.country = 'USA' ORDER BY T1.royalty DESC