question stringlengths 24 325 | sql stringlengths 30 804 | db_id stringclasses 63
values | prompt stringlengths 308 18.9k | question_id int64 167 9.43k | difficulty stringclasses 1
value |
|---|---|---|---|---|---|
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 167 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 168 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 169 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 170 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 171 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 172 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 173 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 174 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 175 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 176 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 177 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 178 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 179 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 180 | |
Name all employees who were hired before year 1990. | SELECT fname, lname FROM employee WHERE STRFTIME('%Y', hire_date) < '1990' | book_publishing_company | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 181 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 182 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 183 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 184 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 185 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 186 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 187 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 188 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 189 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 190 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 191 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 192 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 193 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 194 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 195 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 196 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 197 | |
How many publishers are in the USA? | SELECT COUNT(pub_id) FROM publishers WHERE country = 'USA' | book_publishing_company | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 198 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 199 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 200 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 201 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 202 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 203 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 204 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 205 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 206 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 207 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 208 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 209 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 210 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 211 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 212 | |
Which one is the cheapest business book? | SELECT title FROM titles WHERE type = 'business' ORDER BY price LIMIT 1 | book_publishing_company | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 213 | |
Which type of book had the most pre-paid amount? | SELECT type FROM titles ORDER BY advance DESC LIMIT 1 | book_publishing_company | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 214 | |
What's the royalty for the bestseller book? | SELECT royalty FROM titles ORDER BY ytd_sales DESC LIMIT 1 | book_publishing_company | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 215 | |
Which job level is O'Rourke at? | SELECT job_lvl FROM employee WHERE lname = 'O''Rourke' | book_publishing_company | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 216 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 217 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 218 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 219 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 220 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 221 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 222 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 223 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 224 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 225 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 226 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 227 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 228 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 229 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 230 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 231 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 232 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 233 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 234 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 235 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 236 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 237 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 238 | |
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 | Database Schema:
authors (au_id text, au_lname text, au_fname text, phone text, address text, city text, state text, zip text, contract text, , PRIMARY KEY(au_id), )
#discounts (discounttype text, stor_id text, lowqty integer, highqty integer, discount real, , , FOREIGN KEY(stor_id) REFERENCES stores(stor_id))
#employe... | 239 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 240 | |
When did the earliest complaint start on 2017/3/22? | SELECT MIN(ser_time) FROM callcenterlogs WHERE `Date received` = '2017-03-22' | retail_complains | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 241 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 242 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 243 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 244 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 245 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 246 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 247 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 248 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 249 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 250 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 251 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 252 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 253 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 254 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 255 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 256 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 257 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 258 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 259 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 260 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 261 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 262 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 263 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 264 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 265 | |
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 | Database Schema:
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), FOREIGN KEY(rand client) REFERENCES client(client_... | 266 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.