question
stringlengths
24
325
sql
stringlengths
30
804
db_id
stringclasses
63 values
question_id
int64
167
9.43k
difficulty
stringclasses
1 value
table_names_with_rag
stringlengths
18
220
create_statements_all
listlengths
1
1
create_statements_rag
listlengths
1
1
len_create_all
int64
2
65
len_create_rag
int64
2
65
column_names_with_rag
stringlengths
139
1.24k
Which date has the most ordered quantity? What is the total order quantity on that day?
SELECT ord_date, SUM(qty) FROM sales GROUP BY ord_date ORDER BY SUM(qty) DESC LIMIT 1
book_publishing_company
167
["stores", "titles", "employee", "jobs", "roysched", "sales", "publishers", "discounts"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"sales\": [\"ord_date\", \"qty\", \"ord_num\", \"payterms\", \"stor_id\", \"title_id\"], \"employee\": [\"hire_date\", \"minit\", \"job_id\", \"emp_id\", \"job_lvl\"], \"titles\": [\"pubdate\", \"price\", \"ytd_sales\", \"advance\", \"title_id\", \"pub_id\", \"type\", \"title\"], \"discounts\": [\"discount\", \"disc...
What is the title with the most ordered quantity in year 1992?
SELECT T2.title FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id WHERE STRFTIME('%Y', T1.ord_date) = '1992' ORDER BY T1.qty DESC LIMIT 1
book_publishing_company
168
["stores", "titles", "roysched", "sales", "discounts", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"price\", \"advance\", \"type\", \"title\", \"ytd_sales\", \"title_id\", \"royalty\", \"pub_id\", \"pubdate\", \"notes\"], \"titleauthor\": [\"title_id\", \"au_id\", \"au_ord\", \"royaltyper\"], \"roysched\": [\"title_id\", \"royalty\", \"lorange\", \"hirange\"], \"sales\": [\"title_id\", \"ord_date\", ...
List the title, price and publication date for all sales with 'ON invoice' payment terms.
SELECT T2.title, T2.price, T2.pubdate FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id WHERE T1.payterms = 'ON invoice'
book_publishing_company
169
["stores", "titles", "employee", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"price\", \"ytd_sales\", \"pubdate\", \"title_id\", \"type\", \"title\", \"advance\", \"notes\", \"royalty\", \"pub_id\"], \"sales\": [\"ord_date\", \"title_id\", \"payterms\", \"qty\", \"stor_id\", \"ord_num\"], \"employee\": [\"hire_date\"], \"titleauthor\": [\"title_id\", \"royaltyper\", \"au_ord\", ...
What is the title that have at least 10% royalty without minimum range amount.
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
book_publishing_company
170
["stores", "titles", "roysched", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"royalty\", \"title\", \"title_id\", \"price\", \"type\", \"advance\", \"ytd_sales\", \"pub_id\", \"pubdate\", \"notes\"], \"titleauthor\": [\"royaltyper\", \"title_id\", \"au_id\", \"au_ord\"], \"roysched\": [\"royalty\", \"title_id\", \"lorange\", \"hirange\"], \"sales\": [\"title_id\", \"payterms\", ...
State the title and royalty percentage for title ID BU2075 between 10000 to 50000 range.
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'
book_publishing_company
171
["titles", "employee", "roysched", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"royalty\", \"price\", \"title_id\", \"title\", \"type\", \"ytd_sales\", \"advance\", \"pub_id\", \"pubdate\", \"notes\"], \"titleauthor\": [\"royaltyper\", \"title_id\", \"au_ord\", \"au_id\"], \"roysched\": [\"royalty\", \"title_id\"], \"sales\": [\"title_id\", \"qty\", \"ord_num\", \"stor_id\", \"pay...
Among the titles with royalty percentage, which title has the greatest royalty percentage. State it's minimum range to enjoy this royalty percentage.
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
book_publishing_company
172
["stores", "titles", "employee", "jobs", "roysched", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"royalty\", \"type\", \"advance\", \"title\", \"title_id\", \"price\", \"ytd_sales\", \"pub_id\", \"pubdate\", \"notes\"], \"titleauthor\": [\"royaltyper\", \"title_id\", \"au_id\", \"au_ord\"], \"roysched\": [\"royalty\", \"title_id\", \"lorange\", \"hirange\"], \"sales\": [\"title_id\", \"qty\", \"sto...
Provide a list of titles together with its publisher name for all publishers located in the USA.
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'
book_publishing_company
173
["stores", "titles", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"type\", \"ytd_sales\", \"advance\", \"title\", \"pub_id\", \"title_id\", \"royalty\", \"pubdate\", \"price\", \"notes\"], \"publishers\": [\"city\", \"state\", \"country\", \"pub_name\", \"pub_id\"], \"titleauthor\": [\"au_ord\", \"au_id\", \"royaltyper\", \"title_id\"], \"sales\": [\"title_id\", \"pay...
State the royalty percentage for the most year to date sale title within the 20000 range.
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
book_publishing_company
174
["stores", "titles", "employee", "roysched", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"royalty\", \"ytd_sales\", \"pubdate\", \"price\", \"title\", \"title_id\", \"type\", \"advance\", \"pub_id\", \"notes\"], \"titleauthor\": [\"royaltyper\", \"title_id\", \"au_id\", \"au_ord\"], \"roysched\": [\"royalty\", \"title_id\", \"lorange\", \"hirange\"], \"sales\": [\"ord_date\", \"title_id\", ...
List all titles published in year 1991. Also provide notes details of the title and the publisher's name.
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'
book_publishing_company
175
["titles", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"notes\", \"ytd_sales\", \"type\", \"title\", \"pubdate\", \"title_id\", \"pub_id\", \"royalty\", \"price\", \"advance\"], \"titleauthor\": [\"title_id\", \"royaltyper\", \"au_id\", \"au_ord\"], \"sales\": [\"title_id\", \"stor_id\", \"ord_date\", \"payterms\", \"qty\"], \"publishers\": [\"city\", \"sta...
List all titles with sales of quantity more than 20 and store located in the CA state.
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'
book_publishing_company
176
["stores", "titles", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"ytd_sales\", \"price\", \"type\", \"title\", \"title_id\", \"pub_id\", \"royalty\", \"advance\", \"pubdate\", \"notes\"], \"stores\": [\"state\", \"city\", \"stor_name\", \"stor_id\", \"stor_address\", \"zip\"], \"sales\": [\"title_id\", \"stor_id\", \"ord_num\", \"qty\", \"payterms\", \"ord_date\"], \...
Name the store with the highest quantity in sales? What is the least quantity title from the store's sale?
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
book_publishing_company
177
["stores", "titles", "roysched", "sales", "discounts", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"ytd_sales\", \"price\", \"type\", \"title\", \"title_id\", \"advance\", \"royalty\", \"pub_id\", \"pubdate\", \"notes\"], \"sales\": [\"title_id\", \"ord_num\", \"qty\", \"stor_id\", \"ord_date\", \"payterms\"], \"stores\": [\"stor_name\", \"city\", \"stor_id\", \"state\", \"zip\", \"stor_address\"], \...
Name the title and publisher for title ID BU 2075. Provide all the royalty percentage for all ranges.
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'
book_publishing_company
178
["titles", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"royalty\", \"title\", \"type\", \"advance\", \"ytd_sales\", \"title_id\", \"price\", \"pub_id\", \"pubdate\", \"notes\"], \"titleauthor\": [\"royaltyper\", \"title_id\", \"au_ord\", \"au_id\"], \"roysched\": [\"royalty\", \"title_id\", \"hirange\", \"lorange\"], \"sales\": [\"title_id\", \"qty\", \"ord...
Name the store with ID 7066 and calculate the percentage of the the quantity ordered that were on 'Net 30' payment terms.
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
book_publishing_company
179
["stores", "titles", "roysched", "sales", "publishers", "discounts"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"stores\": [\"city\", \"stor_name\", \"state\", \"stor_id\", \"stor_address\", \"zip\"], \"discounts\": [\"discount\", \"discounttype\", \"lowqty\", \"highqty\", \"stor_id\"], \"sales\": [\"payterms\", \"qty\", \"ord_date\", \"stor_id\", \"ord_num\", \"title_id\"], \"titles\": [\"price\", \"ytd_sales\", \"royalty\",...
State the publisher name for publisher ID 877? Calculate its average year to date sales.
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
book_publishing_company
180
["stores", "titles", "employee", "roysched", "sales", "publishers", "discounts"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"sales\": [\"ord_date\", \"payterms\", \"title_id\", \"ord_num\", \"qty\", \"stor_id\"], \"employee\": [\"hire_date\", \"job_lvl\", \"emp_id\", \"fname\", \"lname\", \"job_id\", \"pub_id\", \"minit\"], \"titles\": [\"ytd_sales\", \"pubdate\", \"price\", \"title_id\", \"type\", \"advance\", \"royalty\", \"title\", \"...
Name all employees who were hired before year 1990.
SELECT fname, lname FROM employee WHERE STRFTIME('%Y', hire_date) < '1990'
book_publishing_company
181
["titles", "employee", "jobs", "roysched", "authors", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"hire_date\", \"job_lvl\", \"job_id\", \"minit\", \"fname\", \"lname\", \"emp_id\", \"pub_id\"], \"jobs\": [\"job_desc\", \"job_id\", \"min_lvl\", \"max_lvl\"], \"publishers\": [\"city\", \"state\", \"pub_name\", \"pub_id\", \"country\"], \"titles\": [\"ytd_sales\", \"title\", \"title_id\", \"type\", ...
Which employee has the lowest job level. State the first name, last name and when he /she was hired.
SELECT fname, lname, hire_date FROM employee ORDER BY job_lvl LIMIT 1
book_publishing_company
182
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"job_lvl\", \"hire_date\", \"job_id\", \"minit\", \"lname\", \"fname\", \"pub_id\", \"emp_id\"], \"jobs\": [\"min_lvl\", \"job_desc\", \"job_id\", \"max_lvl\"], \"discounts\": [\"lowqty\", \"discount\", \"discounttype\", \"highqty\", \"stor_id\"], \"publishers\": [\"state\", \"pub_name\", \"city\"], \...
In which year has the most hired employees?
SELECT STRFTIME('%Y', hire_date) FROM employee GROUP BY STRFTIME('%Y', hire_date) ORDER BY COUNT(emp_id) DESC LIMIT 1
book_publishing_company
183
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"hire_date\", \"job_id\", \"job_lvl\", \"fname\", \"lname\", \"minit\", \"emp_id\", \"pub_id\"], \"jobs\": [\"max_lvl\", \"job_desc\", \"min_lvl\", \"job_id\"], \"stores\": [\"city\", \"state\", \"stor_id\", \"stor_name\", \"stor_address\", \"zip\"], \"publishers\": [\"city\", \"state\", \"country\", ...
List all employees who are at the maximum level in their job designation.
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
book_publishing_company
184
["stores", "titles", "employee", "jobs", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"job_lvl\", \"job_id\", \"hire_date\", \"fname\", \"minit\", \"lname\", \"pub_id\", \"emp_id\"], \"jobs\": [\"max_lvl\", \"job_desc\", \"min_lvl\", \"job_id\"], \"discounts\": [\"highqty\", \"stor_id\", \"discount\"], \"stores\": [\"city\", \"stor_name\", \"stor_id\", \"state\", \"stor_address\"], \"t...
Name the Chief Executive Officer and when he/she was hired.
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'
book_publishing_company
185
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"hire_date\", \"job_lvl\", \"job_id\", \"fname\", \"emp_id\", \"lname\", \"minit\", \"pub_id\"], \"jobs\": [\"job_desc\", \"job_id\", \"min_lvl\", \"max_lvl\"], \"roysched\": [\"hirange\", \"lorange\", \"royalty\", \"title_id\"], \"sales\": [\"ord_date\", \"qty\", \"ord_num\", \"title_id\", \"payterms...
Who are the employees working for publisher not located in USA? State the employee's name and publisher name.
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'
book_publishing_company
186
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"job_lvl\", \"job_id\", \"fname\", \"lname\", \"hire_date\", \"pub_id\", \"minit\", \"emp_id\"], \"publishers\": [\"state\", \"city\", \"country\", \"pub_name\", \"pub_id\"], \"authors\": [\"state\", \"city\", \"au_lname\", \"au_id\", \"au_fname\", \"address\", \"contract\"], \"jobs\": [\"job_desc\", ...
List all employees working for publisher 'GGG&G'. State their name and job description.
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'
book_publishing_company
187
["stores", "titles", "employee", "jobs", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"job_id\", \"job_lvl\", \"hire_date\", \"fname\", \"lname\", \"minit\", \"pub_id\", \"emp_id\"], \"jobs\": [\"job_desc\", \"job_id\", \"min_lvl\", \"max_lvl\"], \"publishers\": [\"state\", \"city\", \"pub_name\", \"country\", \"pub_id\"], \"stores\": [\"city\", \"state\", \"stor_name\", \"stor_id\"], ...
For each publisher, state the type of titles they published order by the publisher name.
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
book_publishing_company
188
["titles", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"type\", \"ytd_sales\", \"royalty\", \"title_id\", \"pub_id\", \"title\", \"advance\", \"pubdate\", \"price\", \"notes\"], \"publishers\": [\"state\", \"pub_name\", \"city\", \"pub_id\", \"country\"], \"titleauthor\": [\"title_id\", \"royaltyper\", \"au_ord\", \"au_id\"], \"sales\": [\"title_id\", \"pay...
Name the publisher which has the most titles published in 1991.
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
book_publishing_company
189
["titles", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"type\", \"ytd_sales\", \"title\", \"royalty\", \"title_id\", \"pubdate\", \"pub_id\", \"price\", \"advance\", \"notes\"], \"titleauthor\": [\"royaltyper\", \"title_id\", \"au_id\", \"au_ord\"], \"publishers\": [\"city\", \"state\", \"pub_name\", \"country\", \"pub_id\"], \"roysched\": [\"title_id\", \"...
Name the title with the highest price published by 'Binnet & Hardley'.
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
book_publishing_company
190
["stores", "titles", "roysched", "sales", "discounts", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"price\", \"type\", \"title_id\", \"title\", \"advance\", \"ytd_sales\", \"pubdate\", \"royalty\", \"pub_id\", \"notes\"], \"discounts\": [\"highqty\", \"discount\", \"discounttype\", \"stor_id\", \"lowqty\"], \"titleauthor\": [\"title_id\", \"au_id\", \"au_ord\", \"royaltyper\"], \"roysched\": [\"title...
Among all employees, who have job level greater than 200. State the employee name and job description.
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
book_publishing_company
191
["stores", "titles", "employee", "jobs", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"job_lvl\", \"job_id\", \"hire_date\", \"lname\", \"minit\", \"fname\", \"pub_id\", \"emp_id\"], \"jobs\": [\"max_lvl\", \"job_desc\", \"job_id\", \"min_lvl\"], \"publishers\": [\"state\", \"city\", \"pub_name\"], \"authors\": [\"state\", \"city\", \"au_lname\", \"au_fname\", \"au_id\"], \"stores\": [...
Name all the authors for all business titles.
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'
book_publishing_company
192
["titles", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"type\", \"title\", \"title_id\", \"advance\", \"pub_id\", \"royalty\", \"ytd_sales\", \"pubdate\", \"notes\", \"price\"], \"authors\": [\"city\", \"au_lname\", \"au_fname\", \"au_id\", \"contract\", \"state\", \"address\", \"phone\", \"zip\"], \"titleauthor\": [\"title_id\", \"royaltyper\", \"au_ord\",...
List all the titles and year to date sales by author who are not on contract.
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
book_publishing_company
193
["titles", "employee", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"ytd_sales\", \"pubdate\", \"title_id\", \"title\", \"type\", \"advance\", \"pub_id\", \"royalty\", \"price\", \"notes\"], \"authors\": [\"contract\", \"au_id\", \"au_lname\", \"au_fname\", \"city\", \"state\", \"zip\", \"address\", \"phone\"], \"sales\": [\"ord_date\", \"title_id\", \"qty\", \"ord_num\...
For all authors from CA who are not on contract, which title of his/hers has the most year to date sales.
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
book_publishing_company
194
["stores", "titles", "employee", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"authors\": [\"contract\", \"state\", \"city\", \"au_id\", \"au_lname\", \"au_fname\", \"address\", \"zip\", \"phone\"], \"titles\": [\"ytd_sales\", \"pubdate\", \"title\", \"title_id\", \"type\", \"pub_id\", \"advance\", \"price\", \"royalty\", \"notes\"], \"sales\": [\"ord_date\", \"title_id\", \"stor_id\", \"qty\...
Name all the authors for 'Sushi, Anyone?'.
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?'
book_publishing_company
195
["stores", "titles", "roysched", "authors", "sales", "pub_info", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"authors\": [\"city\", \"au_id\", \"au_lname\", \"au_fname\", \"address\", \"contract\", \"state\", \"zip\", \"phone\"], \"titleauthor\": [\"au_ord\", \"au_id\", \"royaltyper\", \"title_id\"], \"roysched\": [\"lorange\", \"hirange\", \"title_id\", \"royalty\"], \"discounts\": [\"lowqty\", \"discounttype\", \"highqty...
Calculate the percentage of the employees who are Editor or Designer?
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
book_publishing_company
196
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"job_lvl\", \"hire_date\", \"job_id\", \"lname\", \"emp_id\", \"minit\", \"fname\", \"pub_id\"], \"jobs\": [\"min_lvl\", \"max_lvl\", \"job_id\", \"job_desc\"], \"publishers\": [\"city\", \"pub_id\", \"pub_name\", \"country\", \"state\"], \"authors\": [\"city\", \"au_lname\", \"au_id\", \"au_fname\", ...
List all titles which have year to date sales higher than the average order by pubisher name.
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 )
book_publishing_company
197
["stores", "titles", "sales", "pub_info", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"pubdate\", \"ytd_sales\", \"pub_id\", \"price\", \"advance\", \"type\", \"title_id\", \"royalty\", \"title\", \"notes\"], \"sales\": [\"ord_date\", \"title_id\", \"stor_id\", \"payterms\", \"qty\", \"ord_num\"], \"discounts\": [\"highqty\", \"stor_id\", \"discount\", \"discounttype\", \"lowqty\"], \"pu...
How many publishers are in the USA?
SELECT COUNT(pub_id) FROM publishers WHERE country = 'USA'
book_publishing_company
198
["stores", "titles", "employee", "jobs", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"publishers\": [\"state\", \"city\", \"country\", \"pub_id\", \"pub_name\"], \"authors\": [\"state\", \"city\", \"au_id\", \"au_fname\", \"address\", \"au_lname\", \"contract\", \"phone\", \"zip\"], \"stores\": [\"state\", \"city\", \"stor_id\", \"stor_address\", \"stor_name\", \"zip\"], \"titles\": [\"ytd_sales\", ...
What is the publisher's information of New Moon Books?
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'
book_publishing_company
199
["titles", "authors", "pub_info", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"publishers\": [\"pub_id\", \"city\", \"state\", \"pub_name\", \"country\"], \"authors\": [\"city\", \"au_id\", \"state\", \"address\", \"zip\", \"au_fname\", \"au_lname\", \"contract\", \"phone\"], \"titles\": [\"pubdate\", \"pub_id\", \"advance\", \"type\", \"ytd_sales\", \"royalty\", \"title\", \"notes\", \"price...
Please list the first names of the employees who work as Managing Editor.
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'
book_publishing_company
200
["titles", "employee", "jobs", "roysched", "authors", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"job_id\", \"job_lvl\", \"hire_date\", \"fname\", \"lname\", \"minit\", \"pub_id\", \"emp_id\"], \"jobs\": [\"job_desc\", \"job_id\", \"min_lvl\", \"max_lvl\"], \"authors\": [\"au_lname\", \"city\", \"au_fname\", \"au_id\", \"contract\", \"zip\", \"state\", \"phone\", \"address\"], \"roysched\": [\"hi...
What is the highest level of job to get to for the employee who got hired the earliest?
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
book_publishing_company
201
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"hire_date\", \"job_lvl\", \"job_id\", \"minit\", \"lname\", \"emp_id\", \"fname\", \"pub_id\"], \"jobs\": [\"max_lvl\", \"min_lvl\", \"job_desc\", \"job_id\"], \"discounts\": [\"highqty\", \"lowqty\", \"discount\"], \"roysched\": [\"hirange\", \"lorange\", \"title_id\", \"royalty\"], \"stores\": [\"c...
In which city is the store with the highest total sales quantity located?
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
book_publishing_company
202
["stores", "titles", "employee", "jobs", "roysched", "sales", "publishers", "discounts"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"stores\": [\"city\", \"state\", \"stor_id\", \"stor_name\", \"stor_address\", \"zip\"], \"discounts\": [\"highqty\", \"discount\", \"stor_id\", \"discounttype\", \"lowqty\"], \"publishers\": [\"city\", \"state\", \"country\", \"pub_id\", \"pub_name\"], \"sales\": [\"ord_num\", \"stor_id\", \"qty\", \"ord_date\", \"...
What is the price of the book that sells the best?
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
book_publishing_company
203
["stores", "titles", "roysched", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"price\", \"ytd_sales\", \"royalty\", \"title_id\", \"title\", \"pub_id\", \"type\", \"advance\", \"pubdate\"], \"discounts\": [\"discount\", \"highqty\", \"discounttype\", \"stor_id\", \"lowqty\"], \"sales\": [\"qty\", \"payterms\", \"title_id\", \"stor_id\", \"ord_num\", \"ord_date\"], \"roysched\": [...
Please list the stores that ordered the book "Life Without Fear".
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'
book_publishing_company
204
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"stores\": [\"city\", \"state\", \"stor_name\", \"zip\", \"stor_id\", \"stor_address\"], \"discounts\": [\"highqty\", \"lowqty\", \"discount\", \"stor_id\", \"discounttype\"], \"publishers\": [\"city\", \"state\", \"country\", \"pub_id\", \"pub_name\"], \"roysched\": [\"lorange\", \"hirange\", \"royalty\", \"title_i...
Among the stores that have ordered the book "Life Without Fear", how many of them are located in Massachusetts?
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'
book_publishing_company
205
["stores", "titles", "employee", "jobs", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"stores\": [\"city\", \"state\", \"zip\", \"stor_name\", \"stor_address\", \"stor_id\"], \"titleauthor\": [\"au_id\", \"au_ord\", \"title_id\"], \"publishers\": [\"city\", \"state\", \"pub_id\", \"country\", \"pub_name\"], \"discounts\": [\"highqty\", \"lowqty\", \"discounttype\", \"stor_id\", \"discount\"], \"autho...
In which country is the publisher of the book "Life Without Fear" located?
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'
book_publishing_company
206
["stores", "titles", "employee", "roysched", "authors", "sales", "pub_info", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"publishers\": [\"country\", \"city\", \"state\", \"pub_id\", \"pub_name\"], \"authors\": [\"city\", \"au_id\", \"au_fname\", \"address\", \"state\", \"au_lname\", \"contract\", \"zip\", \"phone\"], \"titleauthor\": [\"au_id\", \"au_ord\", \"title_id\", \"royaltyper\"], \"stores\": [\"city\", \"state\", \"stor_name\...
What is the publisher that has published the most expensive book?
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
book_publishing_company
207
["titles", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"publishers\": [\"city\", \"state\", \"pub_id\", \"country\", \"pub_name\"], \"authors\": [\"au_id\", \"city\", \"au_fname\", \"state\", \"au_lname\", \"address\", \"contract\", \"zip\", \"phone\"], \"titles\": [\"price\", \"pub_id\", \"pubdate\", \"royalty\", \"advance\", \"type\", \"ytd_sales\", \"title\", \"title...
Among the publishers in the USA, how many of them have published books that are over $15?
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
book_publishing_company
208
["stores", "titles", "employee", "jobs", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"publishers\": [\"city\", \"state\", \"country\", \"pub_id\", \"pub_name\"], \"authors\": [\"city\", \"state\", \"au_id\", \"au_fname\", \"contract\", \"au_lname\", \"zip\", \"address\", \"phone\"], \"stores\": [\"city\", \"state\", \"stor_id\", \"stor_name\", \"stor_address\", \"zip\"], \"discounts\": [\"highqty\",...
Please give more detailed information about the first three books that sell the best.
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
book_publishing_company
209
["stores", "titles", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"ytd_sales\", \"advance\", \"price\", \"royalty\", \"pub_id\", \"title_id\", \"title\", \"type\", \"notes\", \"pubdate\"], \"authors\": [\"city\", \"au_id\", \"au_lname\", \"au_fname\", \"state\", \"contract\", \"address\", \"phone\", \"zip\"], \"sales\": [\"stor_id\", \"ord_num\", \"qty\", \"title_id\"...
How many books on business have the bookstores in Massachusetts ordered?
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'
book_publishing_company
210
["stores", "titles", "employee", "jobs", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"stores\": [\"city\", \"state\", \"stor_address\", \"stor_id\", \"stor_name\", \"zip\"], \"publishers\": [\"city\", \"state\", \"pub_id\", \"pub_name\", \"country\"], \"authors\": [\"city\", \"state\", \"address\", \"au_id\", \"au_fname\", \"phone\", \"zip\", \"au_lname\", \"contract\"], \"discounts\": [\"discount\"...
What is the average quantity of each order for the book "Life Without Fear"?
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'
book_publishing_company
211
["stores", "titles", "roysched", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"discounts\": [\"lowqty\", \"highqty\", \"discount\", \"discounttype\", \"stor_id\"], \"titles\": [\"price\", \"advance\", \"ytd_sales\", \"royalty\", \"type\", \"pub_id\", \"pubdate\"], \"authors\": [\"zip\", \"contract\", \"city\", \"au_id\", \"address\", \"phone\", \"au_fname\", \"state\", \"au_lname\"], \"roysch...
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?
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
book_publishing_company
212
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"job_lvl\", \"emp_id\", \"job_id\", \"fname\", \"lname\", \"pub_id\", \"hire_date\", \"minit\"], \"jobs\": [\"max_lvl\", \"min_lvl\", \"job_desc\", \"job_id\"], \"discounts\": [\"highqty\"], \"titles\": [\"title\", \"price\", \"title_id\", \"advance\", \"pub_id\", \"type\", \"pubdate\", \"royalty\", \...
Which one is the cheapest business book?
SELECT title FROM titles WHERE type = 'business' ORDER BY price LIMIT 1
book_publishing_company
213
["stores", "titles", "roysched", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"discounts\": [\"lowqty\", \"stor_id\", \"discount\", \"discounttype\", \"highqty\"], \"publishers\": [\"state\", \"city\", \"pub_id\", \"country\", \"pub_name\"], \"stores\": [\"city\", \"state\", \"stor_id\", \"stor_address\", \"stor_name\", \"zip\"], \"authors\": [\"city\", \"zip\", \"state\", \"phone\", \"addres...
Which type of book had the most pre-paid amount?
SELECT type FROM titles ORDER BY advance DESC LIMIT 1
book_publishing_company
214
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"sales\": [\"payterms\", \"qty\"], \"discounts\": [\"lowqty\", \"discount\", \"discounttype\", \"stor_id\", \"highqty\"], \"publishers\": [\"pub_id\", \"city\", \"pub_name\", \"state\", \"country\"], \"authors\": [\"contract\", \"city\", \"au_id\", \"au_fname\", \"au_lname\", \"zip\", \"state\"], \"roysched\": [\"lo...
What's the royalty for the bestseller book?
SELECT royalty FROM titles ORDER BY ytd_sales DESC LIMIT 1
book_publishing_company
215
["stores", "titles", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"roysched\": [\"royalty\", \"lorange\", \"hirange\", \"title_id\"], \"titles\": [\"royalty\", \"ytd_sales\", \"price\", \"type\", \"title_id\", \"title\", \"advance\", \"pub_id\", \"pubdate\"], \"titleauthor\": [\"royaltyper\", \"au_id\", \"au_ord\", \"title_id\"], \"sales\": [\"title_id\", \"qty\", \"stor_id\", \"p...
Which job level is O'Rourke at?
SELECT job_lvl FROM employee WHERE lname = 'O''Rourke'
book_publishing_company
216
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"jobs\": [\"job_desc\", \"job_id\", \"max_lvl\", \"min_lvl\"], \"employee\": [\"job_lvl\", \"job_id\", \"hire_date\", \"pub_id\", \"minit\", \"fname\", \"emp_id\", \"lname\"], \"authors\": [\"city\", \"au_id\", \"au_lname\", \"au_fname\", \"state\", \"contract\", \"zip\", \"address\"], \"titleauthor\": [\"au_ord\", ...
Show me the employ id of the highest employee who doesn't have a middle name.
SELECT emp_id FROM employee WHERE minit = '' ORDER BY job_lvl DESC LIMIT 1
book_publishing_company
217
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"job_lvl\", \"hire_date\", \"job_id\", \"lname\", \"fname\", \"minit\", \"emp_id\", \"pub_id\"], \"jobs\": [\"max_lvl\", \"min_lvl\", \"job_desc\", \"job_id\"], \"discounts\": [\"highqty\", \"lowqty\", \"discount\", \"discounttype\"], \"roysched\": [\"lorange\", \"royalty\", \"hirange\", \"title_id\"]...
Is the author of "Sushi, Anyone?" on the contract?
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?'
book_publishing_company
218
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"authors\": [\"contract\", \"au_id\", \"city\", \"au_fname\", \"au_lname\", \"phone\", \"state\", \"zip\", \"address\"], \"titleauthor\": [\"au_ord\", \"au_id\", \"title_id\", \"royaltyper\"], \"discounts\": [\"lowqty\", \"highqty\", \"discounttype\", \"discount\", \"stor_id\"], \"titles\": [\"pubdate\", \"price\", ...
Which publisher had the highest job level? Give his/her full name.
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
book_publishing_company
219
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"jobs\": [\"max_lvl\", \"job_desc\", \"job_id\", \"min_lvl\"], \"employee\": [\"job_lvl\", \"job_id\", \"hire_date\", \"fname\", \"lname\", \"minit\", \"pub_id\", \"emp_id\"], \"discounts\": [\"highqty\", \"discount\", \"discounttype\"], \"publishers\": [\"city\", \"state\", \"pub_name\", \"pub_id\", \"country\"], \...
What's Pedro S Afonso's job title?
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'
book_publishing_company
220
["titles", "employee", "jobs", "roysched", "authors", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titleauthor\": [\"au_id\", \"au_ord\", \"title_id\", \"royaltyper\"], \"jobs\": [\"job_desc\", \"job_id\", \"max_lvl\", \"min_lvl\"], \"titles\": [\"type\", \"title\", \"pubdate\", \"title_id\", \"pub_id\", \"advance\", \"notes\", \"ytd_sales\", \"price\", \"royalty\"], \"employee\": [\"job_lvl\", \"job_id\", \"hir...
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?
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'
book_publishing_company
221
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"jobs\": [\"max_lvl\", \"min_lvl\", \"job_desc\", \"job_id\"], \"employee\": [\"job_lvl\", \"minit\", \"hire_date\", \"job_id\", \"emp_id\", \"pub_id\", \"lname\"], \"authors\": [\"city\", \"contract\", \"au_id\", \"au_lname\", \"state\", \"zip\", \"au_fname\", \"phone\", \"address\"], \"roysched\": [\"lorange\", \"...
What's on the notes for the order happened on 1994/9/14?
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'
book_publishing_company
222
["stores", "titles", "employee", "sales", "pub_info", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"notes\", \"pubdate\", \"ytd_sales\", \"title\", \"pub_id\", \"type\", \"advance\"], \"employee\": [\"hire_date\", \"emp_id\", \"job_lvl\", \"pub_id\", \"job_id\"], \"sales\": [\"ord_date\", \"payterms\", \"ord_num\"], \"titleauthor\": [\"au_ord\", \"au_id\", \"title_id\", \"royaltyper\"], \"publishers\...
List the type of the book for the order which was sold on 1993/5/29.
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'
book_publishing_company
223
["stores", "titles", "sales", "publishers", "discounts"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"ytd_sales\", \"type\", \"price\", \"pubdate\", \"pub_id\", \"advance\", \"royalty\", \"notes\", \"title_id\", \"title\"], \"sales\": [\"ord_date\", \"payterms\", \"qty\", \"ord_num\", \"stor_id\", \"title_id\"], \"discounts\": [\"discounttype\", \"discount\", \"lowqty\", \"stor_id\", \"highqty\"], \"pu...
Tell me about the information of the French publisher.
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'
book_publishing_company
224
["titles", "roysched", "authors", "pub_info", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"publishers\": [\"city\", \"country\", \"state\", \"pub_id\", \"pub_name\"], \"pub_info\": [\"pr_info\", \"pub_id\", \"logo\"], \"authors\": [\"city\", \"au_id\", \"au_fname\", \"au_lname\", \"phone\", \"contract\", \"address\", \"state\", \"zip\"], \"roysched\": [\"royalty\", \"lorange\", \"hirange\", \"title_id\"]...
What's the publisher of the book "Silicon Valley Gastronomic Treats"? Give the publisher's name.
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'
book_publishing_company
225
["stores", "titles", "roysched", "authors", "sales", "pub_info", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"publishers\": [\"city\", \"state\", \"pub_name\", \"pub_id\", \"country\"], \"authors\": [\"city\", \"state\", \"contract\", \"au_fname\", \"address\", \"au_id\", \"au_lname\", \"phone\", \"zip\"], \"stores\": [\"city\", \"stor_name\", \"state\", \"stor_id\"], \"titleauthor\": [\"au_ord\", \"au_id\", \"royaltyper\"...
Which city did Victoria P Ashworth work in?
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'
book_publishing_company
226
["stores", "titles", "employee", "jobs", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"stores\": [\"city\", \"stor_address\", \"state\", \"zip\", \"stor_name\", \"stor_id\"], \"authors\": [\"city\", \"au_id\", \"state\", \"au_fname\", \"address\", \"au_lname\", \"contract\", \"zip\"], \"publishers\": [\"city\", \"state\", \"country\", \"pub_id\", \"pub_name\"], \"jobs\": [\"job_desc\", \"job_id\", \"...
How many sales did the store in Remulade make?
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'
book_publishing_company
227
["stores", "titles", "employee", "jobs", "roysched", "sales", "publishers", "discounts"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"stores\": [\"city\", \"state\", \"stor_id\", \"stor_name\", \"stor_address\", \"zip\"], \"titles\": [\"ytd_sales\", \"price\", \"royalty\", \"title\", \"title_id\", \"advance\", \"type\", \"notes\", \"pub_id\"], \"sales\": [\"ord_num\", \"qty\", \"stor_id\", \"title_id\", \"payterms\", \"ord_date\"], \"discounts\":...
For the quantities, what percent more did the store in Fremont sell than the store in Portland in 1993?
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'
book_publishing_company
228
["stores", "titles", "roysched", "sales", "publishers", "discounts"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"stores\": [\"city\", \"state\", \"zip\", \"stor_id\", \"stor_name\", \"stor_address\"], \"titles\": [\"ytd_sales\", \"price\", \"royalty\", \"title\", \"pub_id\", \"advance\"], \"sales\": [\"ord_num\", \"qty\", \"stor_id\", \"ord_date\", \"title_id\", \"payterms\"], \"publishers\": [\"city\", \"state\", \"pub_id\",...
Among all the employees, how many percent more for the publishers than designers?
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
book_publishing_company
229
["stores", "titles", "employee", "jobs", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"job_lvl\", \"job_id\", \"hire_date\", \"minit\", \"fname\", \"lname\", \"emp_id\", \"pub_id\"], \"publishers\": [\"city\", \"state\", \"country\", \"pub_id\", \"pub_name\"], \"jobs\": [\"max_lvl\", \"min_lvl\", \"job_desc\", \"job_id\"], \"authors\": [\"city\", \"au_id\", \"au_lname\", \"au_fname\", ...
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.
SELECT fname, minit, lname FROM employee WHERE STRFTIME('%Y', hire_date) BETWEEN '1990' AND '1995' ORDER BY job_lvl DESC
book_publishing_company
230
["titles", "employee", "roysched", "sales", "publishers", "jobs"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"employee\": [\"hire_date\", \"job_lvl\", \"job_id\", \"minit\", \"fname\", \"lname\", \"emp_id\", \"pub_id\"], \"jobs\": [\"job_desc\", \"job_id\", \"min_lvl\", \"max_lvl\"], \"sales\": [\"ord_date\", \"title_id\", \"qty\", \"payterms\", \"ord_num\"], \"titles\": [\"ytd_sales\", \"pubdate\", \"title_id\", \"type\",...
Which titles has above average royalty rate? Give those title's name, type and price?
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 )
book_publishing_company
231
["stores", "titles", "roysched", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"royalty\", \"price\", \"type\", \"advance\", \"title_id\", \"title\", \"ytd_sales\", \"pub_id\", \"pubdate\", \"notes\"], \"titleauthor\": [\"royaltyper\", \"title_id\", \"au_id\", \"au_ord\"], \"roysched\": [\"royalty\", \"title_id\", \"hirange\", \"lorange\"], \"sales\": [\"title_id\", \"payterms\", ...
In 1994 which title had less order quanty than the average order quantity? Find the title name, type and price.
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 )
book_publishing_company
232
["stores", "titles", "roysched", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"price\", \"ytd_sales\", \"type\", \"title_id\", \"title\", \"pub_id\", \"pubdate\", \"advance\", \"royalty\", \"notes\"], \"discounts\": [\"lowqty\", \"highqty\", \"discounttype\", \"discount\", \"stor_id\"], \"titleauthor\": [\"title_id\", \"royaltyper\", \"au_ord\", \"au_id\"], \"sales\": [\"title_id...
List the title name, type, and price of the titles published by New Moon Books. Arrange the list in ascending order of price.
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
book_publishing_company
233
["titles", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"price\", \"type\", \"royalty\", \"pub_id\", \"ytd_sales\", \"pubdate\", \"title\", \"title_id\", \"advance\", \"notes\"], \"titleauthor\": [\"royaltyper\", \"title_id\", \"au_id\", \"au_ord\"], \"sales\": [\"title_id\", \"payterms\", \"qty\", \"ord_date\", \"ord_num\"], \"roysched\": [\"title_id\", \"r...
In the books published by US publishers, which book has the highest royalty? List these books in the descending order of royalty.
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
book_publishing_company
234
["stores", "titles", "roysched", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"royalty\", \"ytd_sales\", \"type\", \"title_id\", \"pub_id\", \"price\", \"title\", \"advance\", \"pubdate\"], \"roysched\": [\"royalty\", \"hirange\", \"lorange\", \"title_id\"], \"titleauthor\": [\"royaltyper\", \"au_id\", \"au_ord\", \"title_id\"], \"publishers\": [\"city\", \"state\", \"pub_id\", \...
Find the difference between the average royalty of titles published by US and non US publishers?
SELECT (CAST(SUM(CASE WHEN T2.country = 'USA' THEN T1.royalty ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.country = 'USA' THEN 1 ELSE 0 END)) - (CAST(SUM(CASE WHEN T2.country != 'USA' THEN T1.royalty ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.country != 'USA' THEN 1 ELSE 0 END)) FROM titles AS T1 INNER JOIN publishers AS T2 O...
book_publishing_company
235
["titles", "roysched", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"royalty\", \"advance\", \"type\", \"title\", \"title_id\", \"ytd_sales\", \"price\", \"pub_id\", \"pubdate\", \"notes\"], \"titleauthor\": [\"royaltyper\", \"au_id\", \"au_ord\", \"title_id\"], \"roysched\": [\"royalty\", \"title_id\"], \"publishers\": [\"country\", \"state\", \"city\", \"pub_id\", \"p...
Calculate the average level difference between the Marketing editors hired by the US and non-US publishers?
SELECT (CAST(SUM(CASE WHEN T1.country = 'USA' THEN job_lvl ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.country = 'USA' THEN 1 ELSE 0 END)) - (CAST(SUM(CASE WHEN T1.country != 'USA' THEN job_lvl ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.country != 'USA' THEN 1 ELSE 0 END)) FROM publishers AS T1 INNER JOIN employee AS T2 ON T1...
book_publishing_company
236
["titles", "employee", "jobs", "authors", "sales", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"publishers\": [\"country\", \"city\", \"state\", \"pub_id\", \"pub_name\"], \"employee\": [\"hire_date\", \"job_lvl\", \"emp_id\"], \"jobs\": [\"min_lvl\", \"max_lvl\", \"job_desc\", \"job_id\"], \"authors\": [\"au_id\", \"city\", \"au_lname\", \"state\", \"au_fname\", \"address\", \"contract\", \"phone\", \"zip\"]...
Which title is about helpful hints on how to use your electronic resources, which publisher published it and what is the price of this book?
SELECT T1.title, T2.pub_name, T1.price FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T1.notes = 'Helpful hints on how to use your electronic resources to the best advantage.'
book_publishing_company
237
["titles", "roysched", "sales", "pub_info", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"price\", \"pub_id\", \"type\", \"title\", \"pubdate\", \"ytd_sales\", \"title_id\", \"advance\", \"royalty\", \"notes\"], \"titleauthor\": [\"au_id\", \"au_ord\", \"title_id\", \"royaltyper\"], \"roysched\": [\"title_id\", \"royalty\"], \"publishers\": [\"pub_id\", \"pub_name\", \"city\", \"state\", \"...
Of the titles, which title is about the Carefully researched study of the effects of strong emotions on the body, which state-based publisher published this book, and what is the year-to-date sale?
SELECT T1.title, T2.pub_name, T1.ytd_sales FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T1.notes = 'Carefully researched study of the effects of strong emotions on the body. Metabolic charts included.'
book_publishing_company
238
["stores", "titles", "authors", "sales", "discounts", "publishers", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"pubdate\", \"ytd_sales\", \"type\", \"price\", \"advance\", \"title\", \"notes\", \"pub_id\", \"title_id\", \"royalty\"], \"titleauthor\": [\"au_id\", \"title_id\", \"au_ord\", \"royaltyper\"], \"sales\": [\"title_id\", \"ord_date\", \"stor_id\", \"qty\", \"payterms\", \"ord_num\"], \"authors\": [\"sta...
Name the top five titles that sold more than average and list them in descending order of the number of sales in California stores?
SELECT T1.title FROM titles AS T1 INNER JOIN sales AS T2 ON T1.title_id = T2.title_id INNER JOIN publishers AS T3 ON T1.pub_id = T3.pub_id WHERE T2.qty > ( SELECT CAST(SUM(qty) AS REAL) / COUNT(title_id) FROM sales ) AND T3.state = 'CA' ORDER BY T2.qty DESC LIMIT 5
book_publishing_company
239
["stores", "titles", "sales", "discounts", "titleauthor"]
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
[ [ " CREATE TABLE authors ( au_id TEXT, au_lname TEXT NOT NULL, au_fname TEXT NOT NULL, phone TEXT NOT NULL, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT NOT NULL, PRIMARY KEY (au_id) ) ", " CREATE TABLE discounts ( discounttype TEXT NOT NULL, stor_id TEXT, lowqty INT...
11
11
"{\"titles\": [\"ytd_sales\", \"price\", \"advance\", \"type\", \"royalty\", \"title\", \"title_id\", \"pub_id\", \"pubdate\", \"notes\"], \"sales\": [\"title_id\", \"qty\", \"ord_num\", \"stor_id\", \"ord_date\", \"payterms\"], \"stores\": [\"city\", \"stor_name\", \"state\", \"stor_id\", \"zip\", \"stor_address\"], \...
On which day was the most verbose complaint received?
SELECT `Date received` FROM callcenterlogs WHERE ser_time = ( SELECT MAX(ser_time) FROM callcenterlogs )
retail_complains
240
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"events\": [\"Date received\", \"Complaint ID\", \"Date sent to company\", \"Timely response?\", \"Consumer complaint narrative\", \"Consumer disputed?\", \"Issue\", \"Submitted via\", \"Sub-issue\", \"Company response to consumer\", \"Product\", \"Tags\", \"Consumer consent provided?\", \"Client_ID\", \"Sub-product...
When did the earliest complaint start on 2017/3/22?
SELECT MIN(ser_time) FROM callcenterlogs WHERE `Date received` = '2017-03-22'
retail_complains
241
["client", "callcenterlogs", "state", "district", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"callcenterlogs\": [\"ser_start\", \"Complaint ID\", \"Date received\", \"ser_time\", \"priority\", \"type\", \"server\", \"phonefinal\", \"vru+line\", \"call_id\", \"outcome\"], \"events\": [\"Complaint ID\", \"Consumer complaint narrative\", \"Consumer disputed?\", \"Timely response?\", \"Date received\", \"Compan...
Which complaint is more urgent, complaint ID CR2400594 or ID CR2405641?
SELECT CASE WHEN SUM(CASE WHEN `Complaint ID` = 'CR2400594' THEN priority END) > SUM(CASE WHEN `Complaint ID` = 'CR2405641' THEN priority END) THEN 'CR2400594' ELSE 'CR2405641' END FROM callcenterlogs
retail_complains
242
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"events\": [\"Complaint ID\", \"Consumer complaint narrative\", \"Timely response?\", \"Issue\", \"Consumer disputed?\", \"Date sent to company\", \"Company response to consumer\", \"Sub-issue\", \"Consumer consent provided?\", \"Date received\", \"Client_ID\", \"Product\", \"Sub-product\"], \"callcenterlogs\": [\"C...
Please list the full names of all the male clients born after the year 1990.
SELECT first, middle, last FROM client WHERE year > 1990
retail_complains
243
["client", "callcenterlogs", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"client\": [\"sex\", \"year\", \"social\", \"client_id\", \"age\", \"first\", \"last\", \"day\", \"middle\", \"state\", \"district_id\", \"address_2\", \"city\", \"address_1\", \"month\", \"zipcode\", \"email\", \"phone\"], \"events\": [\"Client_ID\", \"Consumer disputed?\", \"Consumer consent provided?\", \"Company...
How many complaints have the client Diesel Galloway filed?
SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Diesel' AND T1.last = 'Galloway'
retail_complains
244
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"client\": [\"city\", \"social\", \"client_id\", \"first\", \"zipcode\", \"district_id\", \"email\", \"address_1\", \"sex\", \"state\", \"last\", \"middle\", \"address_2\", \"year\", \"day\", \"month\", \"phone\", \"age\"], \"callcenterlogs\": [\"rand client\", \"Complaint ID\", \"server\", \"type\", \"ser_start\", ...
What is the detailed product of the complaint filed by Diesel Galloway on 2014/7/3?
SELECT T2.`Sub-product` FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Diesel' AND T1.last = 'Galloway' AND T2.`Date received` = '2014-07-03'
retail_complains
245
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"events\": [\"Product\", \"Sub-product\", \"Consumer disputed?\", \"Complaint ID\", \"Consumer complaint narrative\", \"Company response to consumer\", \"Consumer consent provided?\", \"Client_ID\", \"Timely response?\", \"Date received\", \"Submitted via\", \"Date sent to company\", \"Issue\", \"Tags\"], \"reviews\...
Was the tag in the complaint filed by Matthew Pierce on 2016/10/28 approved by himself?
SELECT CASE WHEN T2.`Consumer consent provided?` IN (NULL, 'N/A', 'Empty') THEN 'No' ELSE 'Yes' END FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Matthew' AND T1.last = 'Pierce' AND T2.`Date received` = '2016-10-28'
retail_complains
246
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"events\": [\"Tags\", \"Complaint ID\", \"Consumer disputed?\", \"Consumer complaint narrative\", \"Timely response?\", \"Consumer consent provided?\", \"Submitted via\", \"Company response to consumer\", \"Date sent to company\", \"Issue\", \"Sub-issue\", \"Date received\", \"Client_ID\", \"Product\", \"Sub-product...
For how long was the complaint filed by Matthew Pierce on 2016/10/28 delayed?
SELECT 365 * (strftime('%Y', T2.`Date sent to company`) - strftime('%Y', T2.`Date received`)) + 30 * (strftime('%M', T2.`Date sent to company`) - strftime('%M', T2.`Date received`)) + (strftime('%d', T2.`Date sent to company`) - strftime('%d', T2.`Date received`)) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_...
retail_complains
247
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"events\": [\"Complaint ID\", \"Timely response?\", \"Consumer complaint narrative\", \"Consumer disputed?\", \"Date sent to company\", \"Date received\", \"Company response to consumer\", \"Issue\", \"Submitted via\", \"Sub-issue\", \"Product\", \"Client_ID\", \"Consumer consent provided?\", \"Tags\", \"Sub-product...
What is the full name of the client whose complaint on 2017/3/27 was received by MICHAL?
SELECT T1.first, T1.middle, T1.last FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T2.`Date received` = '2017-03-27' AND T2.server = 'MICHAL'
retail_complains
248
["client", "callcenterlogs", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"callcenterlogs\": [\"rand client\", \"Date received\", \"Complaint ID\", \"server\", \"priority\", \"type\", \"phonefinal\", \"ser_time\", \"ser_start\", \"vru+line\", \"outcome\", \"ser_exit\"], \"client\": [\"city\", \"client_id\", \"day\", \"first\", \"middle\", \"social\", \"email\", \"state\", \"phone\", \"las...
For how long did the complaint filed on 2017/3/27 by Rachel Hicks last?
SELECT T2.ser_time FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T1.first = 'Rachel' AND T1.last = 'Hicks' AND T2.`Date received` = '2017-03-27'
retail_complains
249
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"events\": [\"Complaint ID\", \"Consumer complaint narrative\", \"Consumer disputed?\", \"Timely response?\", \"Company response to consumer\", \"Date received\", \"Date sent to company\", \"Consumer consent provided?\", \"Submitted via\", \"Issue\", \"Tags\", \"Sub-issue\", \"Product\", \"Client_ID\", \"Sub-product...
Among all the clients from the New York city, how many of them have filed a complaint on the issue of Deposits and withdrawals?
SELECT COUNT(T2.Issue) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.Issue = 'Deposits and withdrawals' AND T1.city = 'New York City'
retail_complains
250
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"client\": [\"city\", \"client_id\", \"day\", \"social\", \"district_id\", \"year\", \"first\", \"address_1\", \"state\", \"last\", \"sex\", \"middle\", \"address_2\", \"phone\", \"zipcode\", \"month\", \"age\", \"email\"], \"events\": [\"Issue\", \"Client_ID\", \"Sub-issue\", \"Complaint ID\", \"Consumer complaint ...
Please list the full names of all the clients whose complaints are still in progress.
SELECT T1.first, T1.middle, T1.last FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Company response to consumer` = 'In progress'
retail_complains
251
["client", "callcenterlogs", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"client\": [\"day\", \"client_id\", \"social\", \"last\", \"first\", \"city\", \"state\", \"year\", \"district_id\", \"middle\", \"sex\", \"address_1\", \"address_2\", \"email\", \"age\", \"month\", \"phone\", \"zipcode\"], \"events\": [\"Client_ID\", \"Consumer disputed?\", \"Consumer complaint narrative\", \"Compl...
Among the clients who did receive a timely response for their complaint, how many of them are from New York?
SELECT COUNT(T1.city) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Timely response?` = 'No' AND T1.city = 'New York City'
retail_complains
252
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"events\": [\"Timely response?\", \"Company response to consumer\", \"Client_ID\", \"Date received\", \"Consumer complaint narrative\", \"Complaint ID\", \"Consumer disputed?\", \"Date sent to company\", \"Consumer consent provided?\", \"Submitted via\", \"Tags\", \"Sub-issue\", \"Issue\", \"Product\", \"Sub-product...
How many complaints on credit cards in the year 2016 were filed by male clients?
SELECT COUNT(T1.sex) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE strftime('%Y', T2.`Date received`) = '2016' AND T1.sex = 'Male' AND T2.Product = 'Credit card'
retail_complains
253
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"client\": [\"year\", \"sex\", \"social\", \"client_id\", \"age\", \"first\", \"state\", \"city\", \"address_1\", \"last\", \"middle\", \"day\", \"address_2\", \"month\", \"district_id\", \"email\", \"zipcode\", \"phone\"], \"events\": [\"Client_ID\", \"Consumer disputed?\", \"Consumer complaint narrative\", \"Compa...
Which division is Diesel Galloway in?
SELECT T2.division FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.first = 'Diesel' AND T1.last = 'Galloway'
retail_complains
254
["client", "callcenterlogs", "state", "district", "reviews"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"district\": [\"division\", \"district_id\", \"state_abbrev\", \"city\"], \"state\": [\"Region\", \"State\", \"StateCode\"], \"client\": [\"district_id\", \"zipcode\", \"city\", \"state\", \"middle\", \"client_id\", \"address_1\", \"year\", \"address_2\", \"month\", \"sex\", \"first\", \"social\"], \"callcenterlogs\...
Please list the full names of all the male clients in the Pacific division.
SELECT T1.first, T1.middle, T1.last FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.division = 'Pacific' AND T1.sex = 'Male'
retail_complains
255
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"district\": [\"division\", \"state_abbrev\", \"city\", \"district_id\"], \"client\": [\"sex\", \"client_id\", \"social\", \"city\", \"middle\", \"state\", \"district_id\", \"last\", \"day\", \"first\", \"zipcode\", \"year\", \"address_1\", \"age\", \"address_2\", \"email\", \"phone\", \"month\"], \"callcenterlogs\"...
What is the average number of complaints on credit cards filed by clients from New York in the 3 consecutive years starting from 2015?
SELECT CAST(COUNT(T2.`Complaint ID`) AS REAL) / 3 AS average FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE strftime('%Y', T2.`Date received`) BETWEEN '2015' AND '2017' AND T1.city = 'New York City' AND T2.Product = 'Credit card'
retail_complains
256
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"client\": [\"year\", \"city\", \"client_id\", \"social\", \"age\", \"zipcode\", \"district_id\", \"last\", \"phone\", \"first\", \"state\", \"address_1\", \"day\", \"middle\", \"sex\", \"address_2\", \"email\", \"month\"], \"events\": [\"Client_ID\", \"Consumer complaint narrative\", \"Consumer disputed?\", \"Compl...
What is the percentage of the increase of complaints filed by the clients from New York from the year 2016 to the year 2017?
SELECT 100.0 * (SUM(CASE WHEN strftime('%Y', T2.`Date received`) = '2017' THEN 1 ELSE 0 END) - SUM(CASE WHEN strftime('%Y', T2.`Date received`) = '2016' THEN 1 ELSE 0 END)) / SUM(CASE WHEN strftime('%Y', T2.`Date received`) = '2016' THEN 1 ELSE 0 END) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Clien...
retail_complains
257
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"client\": [\"year\", \"city\", \"social\", \"day\", \"state\", \"client_id\", \"age\", \"sex\", \"first\", \"district_id\", \"address_1\", \"month\", \"email\", \"zipcode\", \"middle\", \"last\", \"address_2\", \"phone\"], \"events\": [\"Client_ID\", \"Complaint ID\", \"Consumer complaint narrative\", \"Company res...
What was the serve time for the complaint call from client "C00007127" on 2017/2/22?
SELECT T1.ser_time FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.Client_ID = 'C00007127' AND T1.`Date received` = '2017-02-22'
retail_complains
258
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"callcenterlogs\": [\"ser_time\", \"rand client\", \"Date received\", \"Complaint ID\", \"server\", \"priority\", \"phonefinal\", \"ser_start\", \"outcome\", \"call_id\", \"ser_exit\", \"type\", \"vru+line\"], \"client\": [\"day\", \"month\", \"phone\", \"city\", \"address_2\", \"state\", \"year\", \"social\", \"sex...
Which state does the owner of "wyatt.collins@gmail.com" live in? Give the full name of the state.
SELECT T1.state FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.email = 'wyatt.collins@gmail.com'
retail_complains
259
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"state\": [\"Region\", \"State\", \"StateCode\"], \"district\": [\"state_abbrev\", \"city\", \"district_id\", \"division\"], \"client\": [\"state\", \"email\", \"city\", \"social\", \"district_id\", \"phone\", \"last\", \"client_id\", \"address_1\", \"first\", \"year\", \"day\", \"middle\", \"sex\", \"address_2\"], ...
Which detailed product did Mr Lennox Oliver Drake complain about?
SELECT DISTINCT T2.`Sub-product` FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Lennox' AND T1.middle = 'Oliver' AND T1.last = 'Drake' AND T1.sex = 'Male'
retail_complains
260
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"events\": [\"Product\", \"Sub-product\", \"Consumer disputed?\", \"Company response to consumer\", \"Consumer complaint narrative\", \"Client_ID\", \"Consumer consent provided?\", \"Timely response?\", \"Complaint ID\", \"Issue\", \"Sub-issue\", \"Tags\", \"Date sent to company\"], \"reviews\": [\"Product\", \"Date...
What was the detailed issue did Mr Gunner Omer Fuller complain about?
SELECT T2.`Sub-issue` FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Gunner' AND T1.middle = 'Omer' AND T1.last = 'Fuller' AND T1.sex = 'Male'
retail_complains
261
["client", "callcenterlogs", "state", "district", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"events\": [\"Issue\", \"Sub-issue\", \"Consumer disputed?\", \"Complaint ID\", \"Consumer complaint narrative\", \"Client_ID\", \"Tags\", \"Timely response?\", \"Company response to consumer\", \"Product\", \"Sub-product\", \"Submitted via\"], \"callcenterlogs\": [\"priority\", \"server\", \"ser_start\", \"type\", ...
Did Ms. Lyric Emely Taylor provide the consent for result of the complaint call on 2016/5/20?
SELECT CASE WHEN T2.`Consumer consent provided?` IN (NULL, 'N/A', '') THEN 'No' ELSE 'Yes' END FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Lyric' AND T1.middle = 'Emely' AND T1.last = 'Taylor' AND T1.sex = 'Female' AND T2.`Date received` = '2016-05-20'
retail_complains
262
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"events\": [\"Consumer consent provided?\", \"Complaint ID\", \"Consumer complaint narrative\", \"Consumer disputed?\", \"Timely response?\", \"Company response to consumer\", \"Submitted via\", \"Date received\", \"Date sent to company\"], \"callcenterlogs\": [\"Complaint ID\", \"Date received\", \"outcome\", \"cal...
How many days delay for the complaint call from Mr. Brantley Julian Stanley on 2012/5/18?
SELECT 365 * (strftime('%Y', T2.`Date sent to company`) - strftime('%Y', T2.`Date received`)) + 30 * (strftime('%M', T2.`Date sent to company`) - strftime('%M', T2.`Date received`)) + (strftime('%d', T2.`Date sent to company`) - strftime('%d', T2.`Date received`)) AS days FROM client AS T1 INNER JOIN events AS T2 ON T1...
retail_complains
263
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"callcenterlogs\": [\"Date received\", \"Complaint ID\", \"ser_time\", \"priority\", \"call_id\", \"phonefinal\", \"outcome\", \"type\", \"vru+line\", \"ser_start\", \"server\", \"rand client\", \"ser_exit\"], \"events\": [\"Timely response?\", \"Complaint ID\", \"Date received\", \"Consumer complaint narrative\", \...
Which district did the review on 2018/9/11 come from? Give the name of the city.
SELECT T2.district_id, T2.city FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.Date = '2018-09-11'
retail_complains
264
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"reviews\": [\"district_id\", \"Reviews\", \"Date\", \"Stars\", \"Product\"], \"district\": [\"city\", \"district_id\", \"division\", \"state_abbrev\"], \"client\": [\"district_id\", \"city\", \"day\", \"phone\", \"middle\", \"year\", \"social\", \"last\", \"first\", \"sex\"], \"events\": [\"Timely response?\", \"Co...
What was the review context from Jacksonville on 2017/7/22?
SELECT T1.Reviews FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.city = 'Jacksonville' AND T1.Date = '2017-07-22'
retail_complains
265
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"reviews\": [\"Reviews\", \"Date\", \"district_id\", \"Stars\", \"Product\"], \"events\": [\"Timely response?\", \"Consumer disputed?\", \"Submitted via\", \"Date received\", \"Complaint ID\", \"Consumer complaint narrative\", \"Company response to consumer\", \"Date sent to company\", \"Tags\", \"Issue\", \"Consume...
Which product received a review from Indianapolis on 2016/10/7?
SELECT T1.Product FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.city = 'Indianapolis' AND T1.Date = '2016-10-07'
retail_complains
266
["client", "callcenterlogs", "state", "district", "reviews", "events"]
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
[ [ " CREATE TABLE callcenterlogs ( \"Date received\" DATE, \"Complaint ID\" TEXT, \"rand client\" TEXT, phonefinal TEXT, \"vru+line\" TEXT, call_id INTEGER, priority INTEGER, type TEXT, outcome TEXT, server TEXT, ser_start TEXT, ser_exit TEXT, ser_time TEXT, PRIMARY KEY (\"Complaint ID...
6
6
"{\"reviews\": [\"Product\", \"Reviews\", \"Date\", \"district_id\", \"Stars\"], \"events\": [\"Product\", \"Sub-product\", \"Date received\", \"Company response to consumer\", \"Consumer disputed?\", \"Timely response?\", \"Consumer consent provided?\", \"Submitted via\", \"Date sent to company\", \"Consumer complaint...