db_id
stringclasses
69 values
question
stringlengths
24
476
seed_question
stringlengths
24
362
evidence
stringlengths
1
673
sql
stringlengths
23
1.42k
dsl
unknown
reasoning
stringlengths
0
729
m_schema
stringlengths
24
9.02k
verified
bool
1 class
_dataset_source
stringclasses
2 values
bird_schema
stringclasses
69 values
book_publishing_company
What is the price of the book that sells the best?
What is the price of the book that sells the best?
qty is abbreviation for quantity; sells the best mean with the most sales quantity; MAX(qty)
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
{ "tables": [ "sales", "titles" ], "dimensions": [ "price" ], "order_by": [ { "expr": "qty", "desc": true } ], "limit": 1, "_source": "sqlite", "filters": [ "sales.title_id = titles.title_id" ] }
# titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID ) # sales ( stor_id, ord_num, ord_date, qty, payterms, title_id )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Please list the stores that ordered the book "Life Without Fear".
Please list the stores that ordered the book "Life Without Fear".
store name refers to stor_name
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'
{ "tables": [ "sales", "stores", "titles" ], "dimensions": [ "stor_name" ], "_source": "sqlite", "filters": [ "titles.title = 'Life Without Fear'", "sales.stor_id = stores.stor_id", "sales.title_id = titles.title_id" ] }
# stores ( stor_id, stor_name, stor_address, city, state, zip ) # sales ( stor_id, ord_num, ord_date, qty, payterms, title_id ) # titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Among the stores that have ordered the book "Life Without Fear", how many of them are located in Massachusetts?
Among the stores that have ordered the book "Life Without Fear", how many of them are located in Massachusetts?
Massachusetts is a state
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'
{ "tables": [ "sales", "stores", "titles" ], "measures": [ { "agg": "COUNT", "expr": "sales.stor_id", "alias": "" } ], "_source": "sqlite", "filters": [ "stores.state = 'Massachusetts'", "sales.stor_id = stores.stor_id", "sales.title_id = titles.title_id" ...
# stores ( stor_id, stor_name, stor_address, city, state, zip ) # sales ( stor_id, ord_num, ord_date, qty, payterms, title_id ) # titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
In which country is the publisher of the book "Life Without Fear" located?
In which country is the publisher of the book "Life Without Fear" located?
Life Without Fear is book title
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'
{ "tables": [ "publishers", "titles" ], "dimensions": [ "country" ], "_source": "sqlite", "filters": [ "titles.title = 'Life Without Fear'", "titles.pub_id = publishers.pub_id" ] }
# publishers ( pub_id, pub_name, city, state, country ) # titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
What is the publisher that has published the most expensive book?
What is the publisher that has published the most expensive book?
most expensive book refers to MAX(price)
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
{ "tables": [ "publishers", "titles" ], "dimensions": [ "pub_name" ], "order_by": [ { "expr": "price", "desc": true } ], "limit": 1, "_source": "sqlite", "filters": [ "titles.pub_id = publishers.pub_id" ] }
# publishers ( pub_id, pub_name, city, state, country ) # titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Among the publishers in the USA, how many of them have published books that are over $15?
Among the publishers in the USA, how many of them have published books that are over $15?
are over $15 refers to price>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
{ "tables": [ "publishers", "titles" ], "measures": [ { "agg": "COUNT_DISTINCT", "expr": "titles.pub_id", "alias": "" } ], "_source": "sqlite", "filters": [ "publishers.country = 'USA'", "titles.price > 15", "titles.pub_id = publishers.pub_id" ] }
# publishers ( pub_id, pub_name, city, state, country ) # titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Please give more detailed information about the first three books that sell the best.
Please give more detailed information about the first three books that sell the best.
qty is abbreviation for quantity; sells the best mean with the most sales quantity; MAX(qty)
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
{ "tables": [ "sales", "titles" ], "dimensions": [ "notes" ], "order_by": [ { "expr": "qty", "desc": true } ], "limit": 3, "_source": "sqlite", "filters": [ "titles.title_id = sales.title_id" ] }
# authors ( au_id, au_lname, au_fname, phone, address, city, state, zip, contract ) # jobs ( job_id, job_desc, min_lvl, max_lvl ) # publishers ( pub_id, pub_name, city, state, country ) # employee ( emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date ) # pub_info ( pub_id, logo, pr_info ) # stores ( stor_id...
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
How many books on business have the bookstores in Massachusetts ordered?
How many books on business have the bookstores in Massachusetts ordered?
Massachusetts is a state; business books refers to type = 'business'
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'
{ "tables": [ "sales", "stores", "titles" ], "measures": [ { "agg": "SUM", "expr": "qty", "alias": "" } ], "_source": "sqlite", "filters": [ "stores.state = 'Massachusetts'", "titles.type = 'business'", "sales.stor_id = stores.stor_id", "sales.title_id =...
# authors ( au_id, au_lname, au_fname, phone, address, city, state, zip, contract ) # jobs ( job_id, job_desc, min_lvl, max_lvl ) # publishers ( pub_id, pub_name, city, state, country ) # employee ( emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date ) # pub_info ( pub_id, logo, pr_info ) # stores ( stor_id...
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
What is the average quantity of each order for the book "Life Without Fear"?
What is the average quantity of each order for the book "Life Without Fear"?
qty is abbreviation for quantity; average quantity order = AVG(qty)
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'
{ "tables": [ "sales", "titles" ], "measures": [ { "type": "derived_metric", "operator": "DIVIDE", "operands": [ { "type": "simple_metric", "agg": "SUM", "field": "sales.qty" }, { "type": "simple_metric", "agg"...
# authors ( au_id, au_lname, au_fname, phone, address, city, state, zip, contract ) # jobs ( job_id, job_desc, min_lvl, max_lvl ) # publishers ( pub_id, pub_name, city, state, country ) # employee ( emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date ) # pub_info ( pub_id, logo, pr_info ) # stores ( stor_id...
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Which one is the cheapest business book?
Which one is the cheapest business book?
business books refers to type = 'business'; cheapest book refers to MIN(price)
SELECT title FROM titles WHERE type = 'business' ORDER BY price LIMIT 1
{ "tables": [ "titles" ], "dimensions": [ "title" ], "order_by": [ { "expr": "price", "desc": false } ], "limit": 1, "_source": "sqlite", "filters": [ "type = 'business'" ] }
# authors ( au_id, au_lname, au_fname, phone, address, city, state, zip, contract ) # titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Which type of book had the most pre-paid amount?
Which type of book had the most pre-paid amount?
most pre-paid amount refers to MAX(advance)
SELECT type FROM titles ORDER BY advance DESC LIMIT 1
{ "tables": [ "titles" ], "dimensions": [ "type" ], "order_by": [ { "expr": "advance", "desc": true } ], "limit": 1, "_source": "sqlite" }
# discounts ( discounttype, stor_id, lowqty, highqty, discount ) # titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID ) # titleauthor ( au_id, title_id, au_ord, royaltyper )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
What's the royalty for the bestseller book?
What's the royalty for the bestseller book?
qty is abbreviation for quantity; bestseller means with the most sales quantity; MAX(qty)
SELECT royalty FROM titles ORDER BY ytd_sales DESC LIMIT 1
{ "tables": [ "titles" ], "dimensions": [ "royalty" ], "order_by": [ { "expr": "ytd_sales", "desc": true } ], "limit": 1, "_source": "sqlite" }
# titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID ) # roysched ( title_id, lorange, hirange, royalty ) # titleauthor ( au_id, title_id, au_ord, royaltyper )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Which job level is O'Rourke at?
Which job level is O'Rourke at?
job level refers to job_lvl
SELECT job_lvl FROM employee WHERE lname = 'O''Rourke'
{ "tables": [ "employee" ], "dimensions": [ "job_lvl" ], "_source": "sqlite", "filters": [ "lname = 'O''Rourke'" ] }
# jobs ( job_id, job_desc, min_lvl, max_lvl ) # employee ( emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Is the author of "Sushi, Anyone?" on the contract?
Is the author of "Sushi, Anyone?" on the contract?
contract = 1 means on contract; contract = 0 means not on 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?'
{ "tables": [ "authors", "titleauthor", "titles" ], "dimensions": [ "contract" ], "_source": "sqlite", "filters": [ "titles.title = 'Sushi, Anyone?'", "authors.au_id = titleauthor.au_id", "titleauthor.title_id = titles.title_id" ] }
# authors ( au_id, au_lname, au_fname, phone, address, city, state, zip, contract ) # titleauthor ( au_id, title_id, au_ord, royaltyper ) # titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Which publisher had the highest job level? Give his/her full name.
Which publisher had the highest job level? Give his/her full name.
highest job level refers to MAX(job_lvl)
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
{ "tables": [ "employee", "jobs" ], "dimensions": [ "fname", "minit", "lname" ], "order_by": [ { "expr": "job_lvl", "desc": true } ], "limit": 1, "_source": "sqlite", "filters": [ "employee.job_id = jobs.job_id" ] }
# jobs ( job_id, job_desc, min_lvl, max_lvl ) # publishers ( pub_id, pub_name, city, state, country ) # employee ( emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Tell me about the information of the French publisher.
Tell me about the information of the French publisher.
French publisher means publisher in France where country = 'France'
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'
{ "tables": [ "pub_info", "publishers" ], "dimensions": [ "pr_info" ], "_source": "sqlite", "filters": [ "publishers.country = 'France'", "pub_info.pub_id = publishers.pub_id" ] }
# authors ( au_id, au_lname, au_fname, phone, address, city, state, zip, contract ) # employee ( emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date ) # publishers ( pub_id, pub_name, city, state, country ) # stores ( stor_id, stor_name, stor_address, city, state, zip ) # pub_info ( pub_id, logo, pr_info )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
What's the publisher of the book "Silicon Valley Gastronomic Treats"? Give the publisher's name.
What's the publisher of the book "Silicon Valley Gastronomic Treats"? Give the publisher's name.
publisher name refers to pub_name; Silicon Valley Gastronomic Treats is the title of a book
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'
{ "tables": [ "publishers", "titles" ], "dimensions": [ "pub_name" ], "_source": "sqlite", "filters": [ "titles.title = 'Silicon Valley Gastronomic Treats'", "titles.pub_id = publishers.pub_id" ] }
# publishers ( pub_id, pub_name, city, state, country ) # titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
How many sales did the store in Remulade make?
How many sales did the store in Remulade make?
Remulade is a city; sales in the store refers to ord_num
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'
{ "tables": [ "sales", "stores" ], "measures": [ { "agg": "COUNT", "expr": "ord_num", "alias": "" } ], "_source": "sqlite", "filters": [ "stores.city = 'Remulade'", "sales.stor_id = stores.stor_id" ] }
# stores ( stor_id, stor_name, stor_address, city, state, zip ) # sales ( stor_id, ord_num, ord_date, qty, payterms, title_id ) # titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
For the quantities, what percent more did the store in Fremont sell than the store in Portland in 1993?
For the quantities, what percent more did the store in Fremont sell than the store in Portland in 1993?
qty is abbreviation for quantity; Fremont and Portland are name of city; sell in 1993 refers to YEAR(ord_date) = 1993; percentage = DIVIDE( SUBTRACT(SUM(qty where city = ‘Fremont’ and year(ord_date = 1993)), SUM(qty where city = ‘Portland’ and year(ord_date = 1993))), SUM(qty where city = ‘Fremont’ and year(ord_date =...
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'
{ "tables": [ "sales", "stores" ], "measures": [ { "agg": "CALCULATED", "expr": "(CAST(SUM(CASE WHEN stores.city = 'Fremont' THEN qty END) - SUM(CASE WHEN stores.city = 'Portland' THEN qty END) AS REAL) / NULLIF(SUM(CASE WHEN stores.city = 'Fremont' THEN qty END), 0)) * 100" } ], "...
# stores ( stor_id, stor_name, stor_address, city, state, zip ) # sales ( stor_id, ord_num, ord_date, qty, payterms, title_id )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Among all the employees, how many percent more for the publishers than designers?
Among all the employees, how many percent more for the publishers than designers?
publisher and designer are job descriptions which refers to job_desc; percentage more = 100*(SUBTRACT(SUM(CASE WHERE job_desc = 'publisher), SUM(CASE WHERE job_desc = 'designer'))
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
{ "tables": [ "employee", "jobs" ], "measures": [ { "agg": "CALCULATED", "expr": "(CAST(SUM(CASE WHEN job_desc = 'publisher' THEN 1 ELSE 0 END) - SUM(CASE WHEN job_desc = 'designer' THEN 1 ELSE 0 END) AS REAL) / NULLIF(COUNT(employee.job_id), 0)) * 100" } ], "_source": "sqlite", ...
# publishers ( pub_id, pub_name, city, state, country ) # employee ( emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date ) # jobs ( job_id, job_desc, min_lvl, max_lvl )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
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.
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.
job level refers to job_lvl; YEAR(hire_date) between 1990 and 1995
SELECT fname, minit, lname FROM employee WHERE STRFTIME('%Y', hire_date) BETWEEN '1990' AND '1995' ORDER BY job_lvl DESC
{ "tables": [ "employee" ], "dimensions": [ "fname", "minit", "lname" ], "order_by": [ { "expr": "job_lvl", "desc": true } ], "_source": "sqlite", "filters": [ "STRFTIME('%Y', hire_date) BETWEEN '1990' AND '1995'" ] }
# jobs ( job_id, job_desc, min_lvl, max_lvl ) # employee ( emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date ) # authors ( au_id, au_lname, au_fname, phone, address, city, state, zip, contract ) # publishers ( pub_id, pub_name, city, state, country ) # stores ( stor_id, stor_name, stor_address, city, stat...
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Which titles has above average royalty rate? Give those title's name, type and price?
Which titles has above average royalty rate? Give those title's name, type and price?
average royalty rate = DIVIDE(SUM(royalty), COUNT(title_id))
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 )
{ "tables": [ "roysched", "titles" ], "dimensions": [ "title", "type", "price" ], "_source": "sqlite", "is_distinct": true, "filters": [ { "type": "subquery_comparison", "left": "roysched.royalty", "operator": ">", "nested_subquery": { "tables": [ ...
# titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID ) # titleauthor ( au_id, title_id, au_ord, royaltyper ) # discounts ( discounttype, stor_id, lowqty, highqty, discount ) # roysched ( title_id, lorange, hirange, royalty )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
In 1994 which title had less order quanty than the average order quantity? Find the title name, type and price.
In 1994 which title had less order quanty than the average order quantity? Find the title name, type and price.
orders in 1994 refers to YEAR(ord_date) = 1994; order quantity refers to number of order expressed by ord_num; average order quantity = DIVIDE(SUM(ord_num), COUNT(title_id))
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 )
{ "tables": [ "sales", "titles" ], "dimensions": [ "title", "type", "price" ], "_source": "sqlite", "is_distinct": true, "filters": [ "sales.ord_date LIKE '1994%'", { "type": "subquery_comparison", "left": "sales.Qty", "operator": "<", "nested_subquery":...
# titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID ) # titleauthor ( au_id, title_id, au_ord, royaltyper ) # discounts ( discounttype, stor_id, lowqty, highqty, discount ) # roysched ( title_id, lorange, hirange, royalty ) # sales ( stor_id, ord_num, ord_date, qty, pa...
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
List the title name, type, and price of the titles published by New Moon Books. Arrange the list in ascending order of price.
List the title name, type, and price of the titles published by New Moon Books. Arrange the list in ascending order of price.
Eric the Read Books is a publisher which refers to pub_name;
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
{ "tables": [ "publishers", "titles" ], "dimensions": [ "title", "type", "price" ], "order_by": [ { "expr": "price", "desc": false } ], "_source": "sqlite", "filters": [ "publishers.pub_name = 'New Moon Books'", "titles.pub_id = publishers.pub_id" ] }
# titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID ) # titleauthor ( au_id, title_id, au_ord, royaltyper ) # roysched ( title_id, lorange, hirange, royalty ) # sales ( stor_id, ord_num, ord_date, qty, payterms, title_id, Qty ) # publishers ( pub_id, pub_name, city, st...
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
In the books published by US publishers, which book has the highest royalty? List these books in the descending order of royalty.
In the books published by US publishers, which book has the highest royalty? List these books in the descending order of royalty.
US publisher refers publisher in the US where country = 'USA';
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
{ "tables": [ "publishers", "roysched", "titles" ], "dimensions": [ "title" ], "order_by": [ { "expr": "titles.royalty", "desc": true } ], "_source": "sqlite", "filters": [ "publishers.country = 'USA'", "titles.pub_id = publishers.pub_id", "titles.title_id...
# authors ( au_id, au_lname, au_fname, phone, address, city, state, zip, contract ) # jobs ( job_id, job_desc, min_lvl, max_lvl ) # publishers ( pub_id, pub_name, city, state, country ) # employee ( emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date ) # pub_info ( pub_id, logo, pr_info ) # stores ( stor_id...
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Find the difference between the average royalty of titles published by US and non US publishers?
Find the difference between the average royalty of titles published by US and non US publishers?
US publisher refers publisher in the US where country = 'USA'; non-US publishers refers publisher not in the US where country! = 'USA'; difference = SUBTRACT(AVG(royalty) where country = 'USA', AVG(royalty) where country! = 'USA'))
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...
{ "tables": [ "publishers", "roysched", "titles" ], "measures": [ { "type": "derived_metric", "operator": "SUBTRACT", "operands": [ { "type": "derived_metric", "operator": "DIVIDE", "operands": [ { "type": "filtered_...
# titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID ) # roysched ( title_id, lorange, hirange, royalty ) # titleauthor ( au_id, title_id, au_ord, royaltyper ) # publishers ( pub_id, pub_name, city, state, country )
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Calculate the average level difference between the Marketing editors hired by the US and non-US publishers?
Calculate the average level difference between the Marketing editors hired by the US and non-US publishers?
Marketing manager is a job description which refers to job_desc; US publisher refers publisher in the US where country = 'USA'; non-US publishers refers publisher not in the US where country! = 'USA'; job level refers to job_lvl; average level = AVG(job_lvl)
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...
{ "tables": [ "employee", "jobs", "publishers" ], "measures": [ { "type": "derived_metric", "operator": "SUBTRACT", "operands": [ { "type": "derived_metric", "operator": "DIVIDE", "operands": [ { "type": "filtered_me...
# authors ( au_id, au_lname, au_fname, phone, address, city, state, zip, contract ) # jobs ( job_id, job_desc, min_lvl, max_lvl ) # publishers ( pub_id, pub_name, city, state, country ) # employee ( emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date ) # pub_info ( pub_id, logo, pr_info ) # stores ( stor_id...
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
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?
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?
publisher refers to pub_name; about the title refers to notes
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.'
{ "tables": [ "publishers", "titles" ], "dimensions": [ "title", "pub_name", "price" ], "_source": "sqlite", "filters": [ "titles.notes = 'Helpful hints on how to use your electronic resources to the best advantage.'", "titles.pub_id = publishers.pub_id" ] }
# titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID ) # titleauthor ( au_id, title_id, au_ord, royaltyper ) # publishers ( pub_id, pub_name, city, state, country ) # roysched ( title_id, lorange, hirange, royalty ) # sales ( stor_id, ord_num, ord_date, qty, payterms, t...
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
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?
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?
year to date sales refers to ytd_sales; about the title refers to notes
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.'
{ "tables": [ "publishers", "titles" ], "dimensions": [ "title", "pub_name", "ytd_sales" ], "_source": "sqlite", "filters": [ "titles.notes = 'Carefully researched study of the effects of strong emotions on the body. Metabolic charts included.'", "titles.pub_id = publishers.pub_i...
# titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID ) # titleauthor ( au_id, title_id, au_ord, royaltyper ) # publishers ( pub_id, pub_name, city, state, country ) # roysched ( title_id, lorange, hirange, royalty ) # sales ( stor_id, ord_num, ord_date, qty, payterms, t...
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
book_publishing_company
Name the top five titles that sold more than average and list them in descending order of the number of sales in California stores?
Name the top five titles that sold more than average and list them in descending order of the number of sales in California stores?
qty is abbreviation for quantity; sold more than average refers to qty > AVG(qty); california refers to state = 'CA"
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
{ "tables": [ "publishers", "sales", "titles" ], "dimensions": [ "title" ], "order_by": [ { "expr": "qty", "desc": true } ], "limit": 5, "_source": "sqlite", "filters": [ { "type": "subquery_comparison", "left": "sales.qty", "operator": ">", ...
# titles ( title_id, title, type, pub_id, price, advance, royalty, ytd_sales, notes, pubdate, title_ID ) # authors ( au_id, au_lname, au_fname, phone, address, city, state, zip, contract ) # employee ( emp_id, fname, minit, lname, job_id, job_lvl, pub_id, hire_date ) # sales ( stor_id, ord_num, ord_date, qty, payterms,...
true
simple
CREATE TABLE authors ( au_id TEXT, au_lname TEXT, au_fname TEXT, phone TEXT, address TEXT, city TEXT, state TEXT, zip TEXT, contract TEXT ); CREATE TABLE discounts ( discounttype TEXT, stor_id TEXT, lowqty INTEGER, highqty INTEGER, discount REAL, FOREIGN KEY ...
retail_complains
On which day was the most verbose complaint received?
On which day was the most verbose complaint received?
day received refers to "Date received"; most verbose complaint refers to MAX(ser_time);
SELECT `Date received` FROM callcenterlogs WHERE ser_time = ( SELECT MAX(ser_time) FROM callcenterlogs )
{ "tables": [ "callcenterlogs" ], "dimensions": [ "\"Date received\"" ], "_source": "sqlite", "filters": [ { "type": "subquery_comparison", "left": "ser_time", "operator": "=", "nested_subquery": { "tables": [ "callcenterlogs" ], "measure...
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # callcenterlogs ( Date received, Complaint ID, rand client...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What is the average number of complaints on credit cards filed by clients from New York in the 3 consecutive years starting from 2015?
What is the average number of complaints on credit cards filed by clients from New York in the 3 consecutive years starting from 2015?
average = AVG(Complaint ID); credit cards refers to Product = 'Credit card'; New York refers to city = 'New York'; 3 consecutive years starting from 2015 refers to "Date received" BETWEEN 2015 AND 2017;
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'
{ "tables": [ "client", "events" ], "measures": [ { "agg": "CALCULATED", "expr": "CAST(COUNT(events.\"Complaint ID\") AS REAL) / NULLIF(3, 0)", "alias": "average" } ], "_source": "sqlite", "filters": [ "STRFTIME('%Y', events.\"Date received\") BETWEEN '2015' AND '2017'"...
# state ( StateCode, State, Region ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, add...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What was the serve time for the complaint call from client "C00007127" on 2017/2/22?
What was the serve time for the complaint call from client "C00007127" on 2017/2/22?
serve time refers to ser_time; longer ser_time means more verbose or longer complaint; on 2017/2/22 refers to "Date received" = '2017-02-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'
{ "tables": [ "callcenterlogs", "events" ], "dimensions": [ "ser_time" ], "_source": "sqlite", "filters": [ "events.Client_ID = 'C00007127'", "callcenterlogs.\"Date received\" = '2017-02-22'", "callcenterlogs.\"Complaint ID\" = events.\"Complaint ID\"" ] }
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to compa...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Which product received a review from Indianapolis on 2016/10/7?
Which product received a review from Indianapolis on 2016/10/7?
Indianapolis refers to state = 'Indianapolis'; on 2016/10/7 refers to Date = '2013-04-04';
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'
{ "tables": [ "district", "reviews" ], "dimensions": [ "reviews.Product" ], "_source": "sqlite", "filters": [ "district.city = 'Indianapolis'", "reviews.Date = '2016-10-07'", "reviews.district_id = district.district_id" ] }
# reviews ( Date, Stars, Reviews, Product, district_id ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # ...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
How many stars did "Eagle Capital" received from Little Rock on 2013/4/4?
How many stars did "Eagle Capital" received from Little Rock on 2013/4/4?
Eagle Capital refers to Product = 'Eagle Capital'; Little Rock is a city; on 2013/4/4 refers to Date = '2013-04-04';
SELECT COUNT(T1.Stars) FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.Product = 'Eagle Capital' AND T2.city = 'Little Rock' AND T1.Date = '2013-04-04'
{ "tables": [ "district", "reviews" ], "measures": [ { "agg": "COUNT", "expr": "stars", "alias": "" } ], "_source": "sqlite", "filters": [ "reviews.Product = 'Eagle Capital'", "district.city = 'Little Rock'", "reviews.Date = '2013-04-04'", "reviews.district_...
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to compa...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
For the client who made the complaint call "CR0217298", what was his/her birthday?
For the client who made the complaint call "CR0217298", what was his/her birthday?
complaint call refers to Complaint ID; birthday = year, month, day;
SELECT T1.month, T1.day FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Complaint ID` = 'CR0217298'
{ "tables": [ "client", "events" ], "dimensions": [ "month", "day" ], "_source": "sqlite", "filters": [ "events.\"Complaint ID\" = 'CR0217298'", "client.client_id = events.Client_ID" ] }
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipco...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What was the phone of number of the client who made the complaint call "CR0100432" ?
What was the phone of number of the client who made the complaint call "CR0100432" ?
complaint call refers to Complaint ID;
SELECT T1.phone FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Complaint ID` = 'CR0100432'
{ "tables": [ "client", "events" ], "dimensions": [ "phone" ], "_source": "sqlite", "filters": [ "events.\"Complaint ID\" = 'CR0100432'", "client.client_id = events.Client_ID" ] }
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipco...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
How many priority urgent complaints were received in march of 2017? List the complaint ID of these complaints.
How many priority urgent complaints were received in march of 2017? List the complaint ID of these complaints.
urgent complaints refers to priority = 2; march of 2017 refers to "Date received" BETWEEN '2017-01-01' AND '2017-01-31';
SELECT COUNT(`Complaint ID`) FROM callcenterlogs WHERE `Date received` LIKE '2017-01%' AND priority = ( SELECT MAX(priority) FROM callcenterlogs )
{ "tables": [ "callcenterlogs" ], "measures": [ { "agg": "COUNT", "expr": "\"Complaint ID\"", "alias": "" } ], "_source": "sqlite", "filters": [ "\"Date received\" LIKE '2017-01%'", { "type": "subquery_comparison", "left": "priority", "operator": "=", ...
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # callcenterlogs ( Date received, Complaint ID, rand client...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
List all the states in the South region.
List all the states in the South region.
N/A
SELECT state FROM state WHERE Region = 'South'
{ "tables": [ "state" ], "dimensions": [ "state" ], "_source": "sqlite", "filters": [ "Region = 'South'" ] }
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # state ( StateCode, State, Region )
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Calculate the average age of clients from the Midwest region.
Calculate the average age of clients from the Midwest region.
average age = AVG(age);
SELECT CAST(SUM(T1.age) AS REAL) / COUNT(T3.Region) AS average FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id INNER JOIN state AS T3 ON T2.state_abbrev = T3.StateCode WHERE T3.Region = 'Midwest'
{ "tables": [ "client", "district", "state" ], "measures": [ { "type": "derived_metric", "operator": "DIVIDE", "operands": [ { "type": "simple_metric", "agg": "SUM", "field": "client.age" }, { "type": "simple_metric"...
# client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipcode, district_id ) # district ( district_id, city, state_abbrev, division ) # state ( StateCode, State, Region )
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Find and list the names of districts which has below-average stars for Eagle Capital.
Find and list the names of districts which has below-average stars for Eagle Capital.
below average = AVG(stars) < Stars; Eagle Capital refers to Product = 'Eagle Capital';
SELECT T2.division FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.Product = 'Eagle Capital' AND T1.Stars > ( SELECT AVG(Stars) FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id )
{ "tables": [ "district", "reviews" ], "dimensions": [ "division" ], "_source": "sqlite", "filters": [ "reviews.Product = 'Eagle Capital'", { "type": "subquery_comparison", "left": "reviews.Stars", "operator": ">", "nested_subquery": { "tables": [ ...
# reviews ( Date, Stars, Reviews, Product, district_id ) # district ( district_id, city, state_abbrev, division )
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What is the medium through which most complaints are registered in Florida?
What is the medium through which most complaints are registered in Florida?
medium refers to "Submitted via"; most complaints refers to MAX(Complaint ID); Florida refers to state = 'florida';
SELECT T3.`Submitted via` FROM callcenterlogs AS T1 INNER JOIN client AS T2 ON T1.`rand client` = T2.client_id INNER JOIN events AS T3 ON T1.`Complaint ID` = T3.`Complaint ID` WHERE T2.state = 'FL' GROUP BY T1.`Complaint ID` ORDER BY COUNT(T1.`Complaint ID`) DESC LIMIT 1
{ "tables": [ "callcenterlogs", "client", "events" ], "dimensions": [ "events.\"Submitted via\"" ], "order_by": [ { "expr": "COUNT(callcenterlogs.\"Complaint ID\")", "desc": true } ], "limit": 1, "group_by": [ "callcenterlogs.\"Complaint ID\"" ], "_source": "s...
# state ( StateCode, State, Region ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, add...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What percentage of consumers from Houston disputed complaints?
What percentage of consumers from Houston disputed complaints?
percentage = MULTIPLY(DIVIDE(SUM("Consumer disputed?" = 'Yes' AND city = 'Houston'), COUNT(client_id)), 1.0); Houston refers to city = 'Houston';
SELECT CAST(SUM(CASE WHEN T2.`Consumer disputed?` = 'Yes' AND T1.city = 'Houston' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.client_id) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID
{ "tables": [ "client", "events" ], "measures": [ { "type": "derived_metric", "operator": "DIVIDE", "operands": [ { "type": "filtered_metric", "agg": "SUM", "field": "*", "filter": { "expression": "CASE WHEN events.\"Consume...
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, da...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Find the number of service members who complained in Syracuse.
Find the number of service members who complained in Syracuse.
service members refers to client.client_id; Syracuse refers to city = 'Syracuse';
SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.Tags = 'Servicemember' AND T1.city = 'Syracuse'
{ "tables": [ "client", "events" ], "measures": [ { "agg": "COUNT", "expr": "client.client_id", "alias": "" } ], "_source": "sqlite", "filters": [ "events.Tags = 'Servicemember'", "client.city = 'Syracuse'", "client.client_id = events.Client_ID" ] }
# state ( StateCode, State, Region ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, add...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Among the calls from California, what percentage are priority 1?
Among the calls from California, what percentage are priority 1?
California refers to state = 'California'; percentage = MULTIPLY(DIVIDE(SUM(priority = 1), COUNT("Complaint ID"), 1.0));
SELECT CAST(SUM(CASE WHEN T1.priority = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.priority) FROM callcenterlogs AS T1 INNER JOIN client AS T2 ON T1.`rand client` = T2.client_id INNER JOIN district AS T3 ON T2.district_id = T3.district_id INNER JOIN state AS T4 ON T3.state_abbrev = T4.StateCode WHERE T4.State = 'Ca...
{ "tables": [ "callcenterlogs", "client", "district", "state" ], "measures": [ { "type": "derived_metric", "operator": "DIVIDE", "operands": [ { "type": "filtered_metric", "agg": "SUM", "field": "*", "filter": { "col...
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipco...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Calculate the difference in the average age of elderly and middle-aged clients in the Northeast region.
Calculate the difference in the average age of elderly and middle-aged clients in the Northeast region.
difference in the average = SUBTRACT(AVG(age BETWEEN 35 AND 55), AVG( age > 65)); elderly refers to age > 65; middle-aged refers to age BETWEEN 35 AND 55;
SELECT (CAST(SUM(CASE WHEN T1.age BETWEEN 35 AND 55 THEN T1.age ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.age BETWEEN 35 AND 55 THEN 1 ELSE 0 END)) - (CAST(SUM(CASE WHEN T1.age > 65 THEN T1.age ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.age > 65 THEN 1 ELSE 0 END)) AS difference FROM client AS T1 INNER JOIN district AS T2 O...
{ "tables": [ "client", "district", "state" ], "measures": [ { "type": "derived_metric", "operator": "SUBTRACT", "operands": [ { "type": "derived_metric", "operator": "DIVIDE", "operands": [ { "type": "filtered_metri...
# client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipcode, district_id ) # district ( district_id, city, state_abbrev, division ) # state ( StateCode, State, Region )
true
simple
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, FOREIGN KEY (`rand...
retail_complains
List by their ID number the 3 longest complaints.
List by their ID number the 3 longest complaints.
ID number refers to "Complaint ID"; longest complaints refers to MAX(ser_time);
SELECT `Complaint ID` FROM callcenterlogs ORDER BY ser_time DESC LIMIT 3
{ "tables": [ "callcenterlogs" ], "dimensions": [ "\"Complaint ID\"" ], "order_by": [ { "expr": "ser_time", "desc": true } ], "limit": 3, "_source": "sqlite" }
# client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipcode, district_id ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Identify by their ID all clients who did not give their consent permission.
Identify by their ID all clients who did not give their consent permission.
did not give their consent permission refers to Consumer consent provided is null, 'N/A', or empty;
SELECT Client_ID FROM events WHERE `Consumer consent provided?` = 'N/A' OR 'Consumer consent provided?' IS NULL OR 'Consumer consent provided?' = ''
{ "tables": [ "events" ], "dimensions": [ "Client_ID" ], "_source": "sqlite", "filters": [ "\"Consumer consent provided?\" = 'N/A' OR 'Consumer consent provided?' IS NULL OR 'Consumer consent provided?' = ''" ] }
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to compa...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
List by their ID the complaints received by the company on 25/09/2014 that took the longest.
List by their ID the complaints received by the company on 25/09/2014 that took the longest.
ID of the complaints refers to "Complaint ID"; on 25/09/2014 refers to "Date sent to company" = '2014-09-25'; took the longest = MAX(SUBTRACT("Date sent to company", "Date received"));
SELECT `Complaint ID` FROM events WHERE strftime('%J', `Date sent to company`) - strftime('%J', `Date received`) = ( SELECT MAX(strftime('%J', `Date sent to company`) - strftime('%J', `Date received`)) FROM events WHERE `Date sent to company` = '2014-09-25' ) AND `Date sent to company` = '2014-09-25'
{ "tables": [ "events" ], "dimensions": [ "\"Complaint ID\"" ], "_source": "sqlite", "filters": [ { "type": "subquery_comparison", "left": "STRFTIME('%J', \"Date sent to company\") - STRFTIME('%J', \"Date received\")", "operator": "=", "nested_subquery": { "tables...
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # callcenterlogs ( Date received, Complaint ID, rand client...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
How many complaints are not in process with an agent?
How many complaints are not in process with an agent?
not in process with an agent refers to outcome ! = 'AGENT';
SELECT COUNT(outcome) FROM callcenterlogs WHERE outcome != 'AGENT'
{ "tables": [ "callcenterlogs" ], "measures": [ { "agg": "COUNT", "expr": "outcome", "alias": "" } ], "_source": "sqlite", "filters": [ "outcome <> 'AGENT'" ] }
# state ( StateCode, State, Region ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, add...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
How many Credit Card complaints did Sharon handle?
How many Credit Card complaints did Sharon handle?
Credit Card refers to Product = 'Credit Card'; Sharon refers to server = 'SHARON';
SELECT COUNT(T1.`Complaint ID`) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.Product = 'Credit card' AND T1.server = 'SHARON'
{ "tables": [ "callcenterlogs", "events" ], "measures": [ { "agg": "COUNT", "expr": "callcenterlogs.\"Complaint ID\"", "alias": "" } ], "_source": "sqlite", "filters": [ "events.Product = 'Credit card'", "callcenterlogs.server = 'SHARON'", "callcenterlogs.\"Comp...
# state ( StateCode, State, Region ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, add...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
In which region have the most 1-star reviews been done?
In which region have the most 1-star reviews been done?
most 1-star reviews refers to MAX(COUNT(stars = 1));
SELECT T3.Region FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id INNER JOIN state AS T3 ON T2.state_abbrev = T3.StateCode WHERE T1.Stars = 1 GROUP BY T3.Region ORDER BY COUNT(T3.Region) DESC LIMIT 1
{ "tables": [ "district", "reviews", "state" ], "dimensions": [ "region" ], "order_by": [ { "expr": "COUNT(region)", "desc": true } ], "limit": 1, "group_by": [ "region" ], "_source": "sqlite", "filters": [ "reviews.Stars = 1", "reviews.district_id =...
# reviews ( Date, Stars, Reviews, Product, district_id ) # state ( StateCode, State, Region ) # district ( district_id, city, state_abbrev, division )
true
simple
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, FOREIGN KEY (`rand...
retail_complains
In what years were the clients who demanded more problems with Certificate of deposit born?
In what years were the clients who demanded more problems with Certificate of deposit born?
more problems with Certificate refers to MAX(COUNT("Sub-product" = '(CD) Certificate of deposit'));
SELECT T1.year FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Sub-product` = '(CD) Certificate of deposit' GROUP BY T1.year ORDER BY COUNT(T1.year) DESC LIMIT 1
{ "tables": [ "client", "events" ], "dimensions": [ "year" ], "order_by": [ { "expr": "COUNT(year)", "desc": true } ], "limit": 1, "group_by": [ "year" ], "_source": "sqlite", "filters": [ "events.\"Sub-product\" = '(CD) Certificate of deposit'", "client...
# state ( StateCode, State, Region ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, add...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
How many cases of billing dispute issues occurred in the Mountain division?
How many cases of billing dispute issues occurred in the Mountain division?
billing dispute refers to issue = 'Billing disputes';
SELECT COUNT(T1.Issue) FROM events AS T1 INNER JOIN client AS T2 ON T1.Client_ID = T2.client_id INNER JOIN district AS T3 ON T2.district_id = T3.district_id WHERE T1.Issue = 'Billing disputes' AND T3.division = 'Mountain'
{ "tables": [ "client", "district", "events" ], "measures": [ { "agg": "COUNT", "expr": "issue", "alias": "" } ], "_source": "sqlite", "filters": [ "events.Issue = 'Billing disputes'", "district.division = 'Mountain'", "events.Client_ID = client.client_id", ...
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, da...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Lists the last name of all clients who made a PS-type complaint and were served by TOVA.
Lists the last name of all clients who made a PS-type complaint and were served by TOVA.
PS-type complaint refers to type = 'PS'; served by refers to server;
SELECT t1.last FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T2.type = 'PS' AND T2.server = 'TOVA'
{ "tables": [ "callcenterlogs", "client" ], "dimensions": [ "last" ], "_source": "sqlite", "filters": [ "callcenterlogs.type = 'PS'", "callcenterlogs.server = 'TOVA'", "client.client_id = callcenterlogs.\"rand client\"" ] }
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to compa...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What is the name of the state in which there have been the largest number of complaints with priority 0?
What is the name of the state in which there have been the largest number of complaints with priority 0?
largest number of complaints refers to MAX(COUNT("Complaint ID") WHERE priority = 0);
SELECT T2.state FROM callcenterlogs AS T1 INNER JOIN client AS T2 ON T1.`rand client` = T2.client_id INNER JOIN district AS T3 ON T2.district_id = T3.district_id INNER JOIN state AS T4 ON T3.state_abbrev = T4.StateCode WHERE T1.priority = 0 GROUP BY T2.state ORDER BY COUNT(T2.state) DESC LIMIT 1
{ "tables": [ "callcenterlogs", "client", "district", "state" ], "dimensions": [ "client.state" ], "order_by": [ { "expr": "COUNT(client.state)", "desc": true } ], "limit": 1, "group_by": [ "client.state" ], "_source": "sqlite", "filters": [ "callcen...
# state ( StateCode, State, Region, state ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, ema...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
How many complaints were served in 5 minutes or less by DORIT and responded to the customer with an explanation, were made by phone?
How many complaints were served in 5 minutes or less by DORIT and responded to the customer with an explanation, were made by phone?
served in 5 minutes or less refers to ser_time < '00:05:00'; DORIT refers to server = 'DORIT'; responded with an explanation refers to "Company response to consumer" = 'Closed with explanation'; made by refers to "Submitted via";
SELECT COUNT(T1.`Complaint ID`) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T1.ser_time < '00:05:00' AND T1.server = 'DORIT' AND T2.`Submitted via` = 'Phone' AND T2.`Company response to consumer` = 'Closed with explanation'
{ "tables": [ "callcenterlogs", "events" ], "measures": [ { "agg": "COUNT", "expr": "callcenterlogs.\"Complaint ID\"", "alias": "" } ], "_source": "sqlite", "filters": [ "callcenterlogs.ser_time < '00:05:00'", "callcenterlogs.server = 'DORIT'", "events.\"Submitt...
# state ( StateCode, State, Region, state ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, ema...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
How many reviews by people between 30 and 50 years include the word 'great'?
How many reviews by people between 30 and 50 years include the word 'great'?
between 30 and 50 years refers to age BETWEEN 30 AND 50; include the word great refers to Review like '%Great%';
SELECT COUNT(T1.Reviews) FROM reviews AS T1 INNER JOIN client AS T2 ON T1.district_id = T2.district_id WHERE T2.age BETWEEN 30 AND 50 AND T1.Reviews LIKE '%great%'
{ "tables": [ "client", "reviews" ], "measures": [ { "agg": "COUNT", "expr": "reviews", "alias": "" } ], "_source": "sqlite", "filters": [ "client.age BETWEEN 30 AND 50", "reviews.Reviews LIKE '%great%'", "reviews.district_id = client.district_id" ] }
# reviews ( Date, Stars, Reviews, Product, district_id ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipcode, district_id )
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What is the average number of stars given by Oregon clients in their reviews?
What is the average number of stars given by Oregon clients in their reviews?
average = DIVIDE(SUM(State = 'Oregon'), COUNT(district_id)); Oregon refers to state = 'Oregon';
SELECT CAST(SUM(T3.Stars) AS REAL) / COUNT(T3.Stars) AS average FROM state AS T1 INNER JOIN district AS T2 ON T1.StateCode = T2.state_abbrev INNER JOIN reviews AS T3 ON T2.district_id = T3.district_id WHERE T1.State = 'Oregon'
{ "tables": [ "district", "reviews", "state" ], "measures": [ { "type": "derived_metric", "operator": "DIVIDE", "operands": [ { "type": "simple_metric", "agg": "SUM", "field": "reviews.Stars" }, { "type": "simple_met...
# reviews ( Date, Stars, Reviews, Product, district_id ) # district ( district_id, city, state_abbrev, division ) # state ( StateCode, State, Region, state )
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What percentage of clients who sent their complaints by postal mail are age 50 and older?
What percentage of clients who sent their complaints by postal mail are age 50 and older?
percentage = MULTIPLY(DIVIDE(SUM("Submitted via" = 'Postal mail'), COUNT(client_id)), 1.0); sent their complaints by refers to "Submitted via"; age > 50;
SELECT CAST(SUM(CASE WHEN T1.age > 50 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.`Submitted via`) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Submitted via` = 'Postal mail'
{ "tables": [ "client", "events" ], "measures": [ { "type": "derived_metric", "operator": "DIVIDE", "operands": [ { "type": "filtered_metric", "agg": "SUM", "field": "*", "filter": { "column": "client.age", "oper...
# client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipcode, district_id ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
How many clients who live in Kansas City provided a 1-star review?
How many clients who live in Kansas City provided a 1-star review?
1-star review refers stars = 1;
SELECT COUNT(T1.Stars) FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.city = 'Kansas City' AND T1.Stars = 1
{ "tables": [ "district", "reviews" ], "measures": [ { "agg": "COUNT", "expr": "stars", "alias": "" } ], "_source": "sqlite", "filters": [ "district.city = 'Kansas City'", "reviews.Stars = 1", "reviews.district_id = district.district_id" ] }
# client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipcode, district_id ) # district ( district_id, city, state_abbrev, division ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complai...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Which state has the highest number of clients who gave a 5-star review?
Which state has the highest number of clients who gave a 5-star review?
highest number of clients refers to MAX(COUNT(client_id)); 5-star review refers to stars = 5;
SELECT T2.state_abbrev FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.Stars = 5 GROUP BY T2.state_abbrev ORDER BY COUNT(T2.state_abbrev) DESC LIMIT 1
{ "tables": [ "district", "reviews" ], "dimensions": [ "state_abbrev" ], "order_by": [ { "expr": "COUNT(state_abbrev)", "desc": true } ], "limit": 1, "group_by": [ "state_abbrev" ], "_source": "sqlite", "filters": [ "reviews.Stars = 5", "reviews.district...
# state ( StateCode, State, Region, state ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipcode, district_id ) # district ( district_id, city, state_abbrev, division ) # reviews ( Date, Stars, Reviews, Prod...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What are the products that people who were born after 2005 complain about?
What are the products that people who were born after 2005 complain about?
year > 2005;
SELECT DISTINCT T2.Product FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.year > 2005
{ "tables": [ "client", "events" ], "dimensions": [ "events.Product" ], "_source": "sqlite", "is_distinct": true, "filters": [ "client.year > 2005", "client.client_id = events.Client_ID" ] }
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # callcenterlogs ( Date received, Complaint ID, rand client...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What was the issue that the client with the longest server time faced?
What was the issue that the client with the longest server time faced?
longest server time refers to MAX(ser_time);
SELECT T2.Issue FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T1.ser_time = ( SELECT MAX(ser_time) FROM callcenterlogs )
{ "tables": [ "callcenterlogs", "events" ], "dimensions": [ "issue" ], "_source": "sqlite", "filters": [ { "type": "subquery_comparison", "left": "callcenterlogs.ser_time", "operator": "=", "nested_subquery": { "tables": [ "callcenterlogs" ],...
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # callcenterlogs ( Date received, Complaint ID, rand client...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
How many clients who live in New York City submitted their complaints via fax?
How many clients who live in New York City submitted their complaints via fax?
submitted complaints via fax refers to "Submitted via" = 'Fax';
SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.city = 'New York City' AND T2.`Submitted via` = 'Fax'
{ "tables": [ "client", "events" ], "measures": [ { "agg": "COUNT", "expr": "client.client_id", "alias": "" } ], "_source": "sqlite", "filters": [ "client.city = 'New York City'", "events.\"Submitted via\" = 'Fax'", "client.client_id = events.Client_ID" ] }
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, da...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What is the birth date of the youngest client?
What is the birth date of the youngest client?
birth date refers to year, month, day; youngest client refers to max(year, month, day)
SELECT day, month, year FROM client ORDER BY year DESC, month DESC, day DESC LIMIT 1
{ "tables": [ "client" ], "dimensions": [ "day", "month", "year" ], "order_by": [ { "expr": "year", "desc": true }, { "expr": "month", "desc": true }, { "expr": "day", "desc": true } ], "limit": 1, "_source": "sqlite" }
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # callcenterlogs ( Date received, Complaint ID, rand client...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
How many times does the consumer have no dispute over a non-timely response from the company?
How many times does the consumer have no dispute over a non-timely response from the company?
no dispute refers to Consumer disputed? = 'No'; non-timely response refers to Timely response? = 'No'
SELECT COUNT(`Timely response?`) FROM events WHERE `Timely response?` = 'No' AND `Consumer disputed?` = 'No'
{ "tables": [ "events" ], "measures": [ { "agg": "COUNT", "expr": "\"Timely response?\"", "alias": "" } ], "_source": "sqlite", "filters": [ "\"Timely response?\" = 'No'", "\"Consumer disputed?\" = 'No'" ] }
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID )
true
simple
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, FOREIGN KEY (`rand...
retail_complains
How many of the complaints are longer than 15 minutes?
How many of the complaints are longer than 15 minutes?
longer than 15 minutes refers to ser_time > '00:15:00'
SELECT COUNT(ser_time) FROM callcenterlogs WHERE strftime('%M', ser_time) > '15'
{ "tables": [ "callcenterlogs" ], "measures": [ { "agg": "COUNT", "expr": "ser_time", "alias": "" } ], "_source": "sqlite", "filters": [ "DATE_EXTRACT('minute', ser_time) > '15'" ] }
# state ( StateCode, State, Region, state ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, ema...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What is the most common issue for the highest priority complaints?
What is the most common issue for the highest priority complaints?
most common refers to max(count(issue)); highest priority refers to priority = 2
SELECT T1.Issue FROM events AS T1 INNER JOIN callcenterlogs AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.priority = 2 GROUP BY T1.Issue ORDER BY COUNT(T1.Issue) DESC LIMIT 1
{ "tables": [ "callcenterlogs", "events" ], "dimensions": [ "issue" ], "order_by": [ { "expr": "COUNT(issue)", "desc": true } ], "limit": 1, "group_by": [ "issue" ], "_source": "sqlite", "filters": [ "callcenterlogs.priority = 2", "events.\"Complaint ID\...
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # callcenterlogs ( Date received, Complaint ID, rand client...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What is the social number of the person who made the most complaints?
What is the social number of the person who made the most complaints?
social number refers to social; most complaints refers to max(count(event.Client_ID))
SELECT T1.social FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID GROUP BY T1.client_id ORDER BY COUNT(T1.client_id) DESC LIMIT 1
{ "tables": [ "client", "events" ], "dimensions": [ "social" ], "order_by": [ { "expr": "COUNT(client.client_id)", "desc": true } ], "limit": 1, "group_by": [ "client.client_id" ], "_source": "sqlite", "filters": [ "client.client_id = events.Client_ID" ] }
# client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipcode, district_id ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Which is the city where most of the 1 star reviews come from?
Which is the city where most of the 1 star reviews come from?
most refers to max(count(state_abbrev)); 1 star review refers to Stars = 1
SELECT T2.city FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.Stars = 1 GROUP BY T2.city ORDER BY COUNT(T2.city) DESC LIMIT 1
{ "tables": [ "district", "reviews" ], "dimensions": [ "district.city" ], "order_by": [ { "expr": "COUNT(district.city)", "desc": true } ], "limit": 1, "group_by": [ "district.city" ], "_source": "sqlite", "filters": [ "reviews.Stars = 1", "reviews.distr...
# reviews ( Date, Stars, Reviews, Product, district_id ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, las...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
List all the server of the phone complaints with a late response from the company.
List all the server of the phone complaints with a late response from the company.
phone complaint refers to Submitted via = 'Phone'; late response refers to Timely response? = 'No'
SELECT DISTINCT T2.server FROM events AS T1 INNER JOIN callcenterlogs AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T1.`Submitted via` = 'Phone' AND T1.`Timely response?` = 'No'
{ "tables": [ "callcenterlogs", "events" ], "dimensions": [ "server" ], "_source": "sqlite", "is_distinct": true, "filters": [ "events.\"Submitted via\" = 'Phone'", "events.\"Timely response?\" = 'No'", "events.\"Complaint ID\" = callcenterlogs.\"Complaint ID\"" ] }
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to compa...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Which region has the second most clients?
Which region has the second most clients?
region refers to division; second most refers to second max(client_id)
SELECT T2.division FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id GROUP BY T2.division ORDER BY COUNT(T2.division) DESC LIMIT 1, 1
{ "tables": [ "client", "district" ], "dimensions": [ "division" ], "order_by": [ { "expr": "COUNT(division)", "desc": true } ], "limit": [ 1, 1 ], "group_by": [ "division" ], "_source": "sqlite", "filters": [ "client.district_id = district.distric...
# state ( StateCode, State, Region, state ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipcode, district_id ) # district ( district_id, city, state_abbrev, division )
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Compute the average time in minute for each age group
Compute the average time in minute for each age group
teenager refers to 13 < age < = 19; adult refers to 19 < age < = 65; elder refers to age < = 65; highest average time per complaint = max(divide(sum(ser_time), count(ser_time)))
SELECT CAST(SUM(CASE WHEN T1.age > 13 AND T1.age <= 19 THEN 60 * strftime('%H', ser_time) + strftime('%M', ser_time) + strftime('%S', ser_time) / 60 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.age > 13 AND T1.age <= 19 THEN 1 ELSE 0 END) AS teenagerAverageMins, CAST(SUM(CASE WHEN T1.age > 19 AND T1.age <= 65 THEN 60 * strf...
{ "tables": [ "callcenterlogs", "client" ], "measures": [ { "type": "derived_metric", "operator": "DIVIDE", "operands": [ { "type": "filtered_metric", "agg": "SUM", "field": "60 * STRFTIME('%H', ser_time) + STRFTIME('%M', ser_time) + STRFTIME('%S...
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipco...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Calculate the percentage of male clients from Indianapolis City.
Calculate the percentage of male clients from Indianapolis City.
male refers to sex = 'Male'; Indianapolis City refers to city = 'Indianapolis'; percentage = divide(count(client_id where sex = 'Male' and city = 'Indianapolis') , count(client_id where city = 'Indianapolis')) * 100%
SELECT CAST(SUM(CASE WHEN sex = 'Male' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(client_id) FROM client WHERE city = 'Indianapolis'
{ "tables": [ "client" ], "measures": [ { "type": "derived_metric", "operator": "DIVIDE", "operands": [ { "type": "filtered_metric", "agg": "SUM", "field": "*", "filter": { "column": "sex", "operator": "=", ...
# state ( StateCode, State, Region, state ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, ema...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Among the teenager clients who use Google account and Microsoft account, which group of client is more than the other?
Among the teenager clients who use Google account and Microsoft account, which group of client is more than the other?
teenager refers to 13 < age < = 19; Google account refers to email like '%@gmail.com'; Microsoft account refers to email like '%@outlook.com'
SELECT CASE WHEN SUM(CASE WHEN email LIKE '%@gmail.com' THEN 1 ELSE 0 END) > SUM(CASE WHEN email LIKE '%@outlook.com' THEN 1 ELSE 0 END) THEN 'Google account' ELSE 'Microsoft account' END FROM client WHERE age BETWEEN 13 AND 19
{ "tables": [ "client" ], "measures": [ { "agg": "CALCULATED", "expr": "CASE WHEN SUM(CASE WHEN email LIKE '%@gmail.com' THEN 1 ELSE 0 END) > SUM(CASE WHEN email LIKE '%@outlook.com' THEN 1 ELSE 0 END) THEN 'Google account' ELSE 'Microsoft account' END", "alias": "" } ], "_source...
# client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipcode, district_id ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
How many clients who live in New York City have the complaint outcome as "AGENT"?
How many clients who live in New York City have the complaint outcome as "AGENT"?
New York City refers to city = 'New York City'
SELECT COUNT(T2.`rand client`) FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T1.city = 'New York City' AND T2.outcome = 'AGENT'
{ "tables": [ "callcenterlogs", "client" ], "measures": [ { "agg": "COUNT", "expr": "callcenterlogs.\"rand client\"", "alias": "" } ], "_source": "sqlite", "filters": [ "client.city = 'New York City'", "callcenterlogs.outcome = 'AGENT'", "client.client_id = call...
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipco...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What are the complaint id of client who were born in 1931?
What are the complaint id of client who were born in 1931?
in 1931 refers to year = 1931
SELECT T2.`Complaint ID` FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T1.year = 1931
{ "tables": [ "callcenterlogs", "client" ], "dimensions": [ "callcenterlogs.\"Complaint ID\"" ], "_source": "sqlite", "filters": [ "client.year = 1931", "client.client_id = callcenterlogs.\"rand client\"" ] }
# client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipcode, district_id ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Complaint about Credit Card mostly came from clients of which age group?
Complaint about Credit Card mostly came from clients of which age group?
about Credit Card refers to Product = 'Credit Card'; teenager refers to 13 < age < = 19; adult refers to 19 < age < = 65; elder refers to age < = 65
SELECT SUM(CASE WHEN T1.age > 13 AND T1.age <= 19 THEN 1 ELSE 0 END), SUM(CASE WHEN T1.age > 19 AND T1.age <= 65 THEN 1 ELSE 0 END) AS adult , SUM(CASE WHEN T1.age > 65 THEN 1 ELSE 0 END) AS elder FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.Product = 'Credit card'
{ "tables": [ "client", "events" ], "measures": [ { "agg": "SUM", "expr": "CASE WHEN age > 13 AND age <= 19 THEN 1 ELSE 0 END", "alias": "" }, { "agg": "SUM", "expr": "CASE WHEN age > 19 AND age <= 65 THEN 1 ELSE 0 END", "alias": "adult" }, { "...
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # callcenterlogs ( Date received, Complaint ID, rand client...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
List down the issues for complaint with server time of below 10 minutes.
List down the issues for complaint with server time of below 10 minutes.
server time of below 10 minutes refers to ser_time < '00:10:00'
SELECT T2.Issue FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE strftime('%M', T1.ser_time) < '10'
{ "tables": [ "callcenterlogs", "events" ], "dimensions": [ "issue" ], "_source": "sqlite", "filters": [ "DATE_EXTRACT('minute', callcenterlogs.ser_time) < '10'", "callcenterlogs.\"Complaint ID\" = events.\"Complaint ID\"" ] }
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to compa...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Write down the date received of complaints sent via Fax.
Write down the date received of complaints sent via Fax.
sent via Fax refers to Submitted via = 'Fax'
SELECT T1.`Date received` FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.`Submitted via` = 'Fax'
{ "tables": [ "callcenterlogs", "events" ], "dimensions": [ "callcenterlogs.\"Date received\"" ], "_source": "sqlite", "filters": [ "events.\"Submitted via\" = 'Fax'", "callcenterlogs.\"Complaint ID\" = events.\"Complaint ID\"" ] }
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # callcenterlogs ( Date received, Complaint ID, rand client...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Write the complaint ID, call ID, and final phone number of complaints through AVIDAN server from 1/1/2014 to 12/30/2014.
Write the complaint ID, call ID, and final phone number of complaints through AVIDAN server from 1/1/2014 to 12/30/2014.
final phone number refers to phonefinal; from 1/1/2014 to 12/30/2014 refers to Date received between '2014-01-01' and '2014-12-30'
SELECT `Complaint ID`, call_id, phonefinal FROM callcenterlogs WHERE strftime('%Y', `Date received`) = '2014' AND server = 'AVIDAN'
{ "tables": [ "callcenterlogs" ], "dimensions": [ "\"Complaint ID\"", "call_id", "phonefinal" ], "_source": "sqlite", "filters": [ { "type": "time_filter", "field": "\"Date received\"", "unit": "YEAR", "operator": "EQ", "value": "2014" }, "server = '...
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to compa...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Between 1/1/2017 and 4/1/2017, what is the average server time of calls under the server DARMON?
Between 1/1/2017 and 4/1/2017, what is the average server time of calls under the server DARMON?
between 1/1/2017 and 4/1/2017 refers to Date received between '2017-01-01' and '2017-04-01'; average server time refers to avg(ser_time)
SELECT AVG(CAST(SUBSTR(ser_time, 4, 2) AS REAL)) FROM callcenterlogs WHERE `Date received` BETWEEN '2017-01-01' AND '2017-04-01'
{ "tables": [ "callcenterlogs" ], "measures": [ { "agg": "AVG", "expr": "CAST(SUBSTRING(ser_time, 4, 2) AS REAL)", "alias": "" } ], "_source": "sqlite", "filters": [ "\"Date received\" BETWEEN '2017-01-01' AND '2017-04-01'" ] }
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to compa...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
How many times per year does a credit card customer complain about overlimit fees?
How many times per year does a credit card customer complain about overlimit fees?
credit card customer refers to product = 'Credit card'; about overlimit fees refers to issue = 'Overlimit fee'
SELECT strftime('%Y', `Date received`), COUNT(`Date received`) FROM events WHERE product = 'Credit card' AND issue = 'Overlimit fee' GROUP BY strftime('%Y', `Date received`) HAVING COUNT(`Date received`)
{ "tables": [ "events" ], "dimensions": [ "DATE_EXTRACT('year', \"Date received\")" ], "measures": [ { "agg": "COUNT", "expr": "\"Date received\"", "alias": "" } ], "_source": "sqlite", "filters": [ "product = 'Credit card'", "issue = 'Overlimit fee'", "COUN...
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID ) # callcenterlogs ( Date received, Complaint ID, rand client...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
List the top five cities in terms of the number of 5-star ratings in 2016 reviews, in descending order.
List the top five cities in terms of the number of 5-star ratings in 2016 reviews, in descending order.
5-star rating refers to Stars = 5; in 2016 refers to Date like '2016%'; most reviews refers to max(count(city))
SELECT T2.city FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.Stars = 5 AND T1.Date LIKE '2016%' ORDER BY T1.Date DESC LIMIT 5
{ "tables": [ "district", "reviews" ], "dimensions": [ "district.city" ], "order_by": [ { "expr": "date", "desc": true } ], "limit": 5, "_source": "sqlite", "filters": [ "reviews.Stars = 5", "reviews.Date LIKE '2016%'", "reviews.district_id = district.distri...
# state ( StateCode, State, Region, state ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, ema...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What is the longest server time when the call is about the issue of arbitration?
What is the longest server time when the call is about the issue of arbitration?
longest server time refers to max(ser_time)
SELECT MAX(T1.ser_time) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.issue = 'Arbitration'
{ "tables": [ "callcenterlogs", "events" ], "measures": [ { "agg": "MAX", "expr": "ser_time", "alias": "" } ], "_source": "sqlite", "filters": [ "events.issue = 'Arbitration'", "callcenterlogs.\"Complaint ID\" = events.\"Complaint ID\"" ] }
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to compa...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Please calculate the number of clients by each division.
Please calculate the number of clients by each division.
N/A
SELECT T2.division, COUNT(T2.division) FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id GROUP BY T2.division
{ "tables": [ "client", "district" ], "dimensions": [ "division" ], "measures": [ { "agg": "COUNT", "expr": "division", "alias": "" } ], "_source": "sqlite", "filters": [ "client.district_id = district.district_id" ] }
# state ( StateCode, State, Region, state ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, ema...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Which city in the Midwest region has the least number of clients?
Which city in the Midwest region has the least number of clients?
least number of clients refers to min(count(client_id))
SELECT T2.city FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id INNER JOIN state AS T3 ON T2.state_abbrev = T3.StateCode WHERE T3.Region = 'Midwest' GROUP BY T2.city ORDER BY COUNT(T2.city) LIMIT 1
{ "tables": [ "client", "district", "state" ], "dimensions": [ "district.city" ], "order_by": [ { "expr": "COUNT(district.city)", "desc": false } ], "limit": 1, "group_by": [ "district.city" ], "_source": "sqlite", "filters": [ "state.Region = 'Midwest'"...
# state ( StateCode, State, Region, state ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipcode, district_id ) # district ( district_id, city, state_abbrev, division )
true
simple
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, FOREIGN KEY (`rand...
retail_complains
What is the percentage of complaints about the late fee issue whose priority is 2 in 2017?
What is the percentage of complaints about the late fee issue whose priority is 2 in 2017?
percentage = divide(count(Complaint ID where priority = 2) , count(Complaint ID)) * 100%; in 2017 refers to year(Date received) = 2017
SELECT CAST(SUM(CASE WHEN T1.priority = 2 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.`Complaint ID`) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE strftime('%Y', T1.`Date received`) = '2017'
{ "tables": [ "callcenterlogs", "events" ], "measures": [ { "type": "derived_metric", "operator": "DIVIDE", "operands": [ { "type": "filtered_metric", "agg": "SUM", "field": "*", "filter": { "column": "callcenterlogs.priorit...
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID, issue ) # callcenterlogs ( Date received, Complaint ID, rand...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Which state has the most cities?
Which state has the most cities?
state refers to state_abbrev; most cities refers to max(count(city))
SELECT state_abbrev FROM district GROUP BY state_abbrev ORDER BY COUNT(city) DESC LIMIT 1
{ "tables": [ "district" ], "dimensions": [ "state_abbrev" ], "order_by": [ { "expr": "COUNT(city)", "desc": true } ], "limit": 1, "group_by": [ "state_abbrev" ], "_source": "sqlite" }
# state ( StateCode, State, Region, state ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, email, address_1, address_2, city, state, zipcode, district_id ) # district ( district_id, city, state_abbrev, division )
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Please list all clients' phone numbers and complaint IDs which are still in progress.
Please list all clients' phone numbers and complaint IDs which are still in progress.
in progress refers to Company response to consumer = 'In progress'
SELECT T1.phone, T2.`Complaint ID` FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Company response to consumer` = 'In progress'
{ "tables": [ "client", "events" ], "dimensions": [ "phone", "events.\"Complaint ID\"" ], "_source": "sqlite", "filters": [ "events.\"Company response to consumer\" = 'In progress'", "client.client_id = events.Client_ID" ] }
# callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to compa...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
In 2014, what is the percentage of complaints from consumers in Houston that the delay was over 5 days?
In 2014, what is the percentage of complaints from consumers in Houston that the delay was over 5 days?
in 2014 refers to Date received LIKE'2014%'; Houston refers to city = 'Houston'; delay over 5 days refers to subtract(Date sent to company, Date received) > 5; percentage = divide(count(Complaint ID where subtract(Date sent to company , Date received) > 5) , count(Complaint ID)) * 100%
SELECT CAST((SUM(CASE WHEN strftime('%J', T2.`Date sent to company`) - strftime('%J', T2.`Date received`) > 5 THEN 1 ELSE 0 END)) AS REAL) * 100 / COUNT(T1.client_id) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.city = 'Houston' AND strftime('%Y', T2.`Date received`) = '2014'
{ "tables": [ "client", "events" ], "measures": [ { "agg": "CALCULATED", "expr": "(CAST((SUM(CASE WHEN STRFTIME('%J', events.\"Date sent to company\") - STRFTIME('%J', events.\"Date received\") > 5 THEN 1 ELSE 0 END)) AS REAL) / NULLIF(COUNT(client.client_id), 0)) * 100" } ], "_sou...
# state ( StateCode, State, Region, state ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, last, phone, ema...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
In the complains received in 2012, how many of them are submitted through email?
In the complains received in 2012, how many of them are submitted through email?
received in 2012 refers to Date received LIKE '2012%'; submitted through email refers to Submitted via = 'Email'
SELECT COUNT(`Submitted via`) FROM events WHERE strftime('%Y', `Date received`) = '2012' AND `Submitted via` = 'Email'
{ "tables": [ "events" ], "measures": [ { "agg": "COUNT", "expr": "\"Submitted via\"", "alias": "" } ], "_source": "sqlite", "filters": [ { "type": "time_filter", "field": "\"Date received\"", "unit": "YEAR", "operator": "EQ", "value": "2012" ...
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID, issue ) # callcenterlogs ( Date received, Complaint ID, rand...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Give the client ID of the complaint received on April 16, 2014 and submitted through fax.
Give the client ID of the complaint received on April 16, 2014 and submitted through fax.
April 16, 2014 refers to Date received = '2014-04-16'; submitted through fax refers to Submitted via = 'Fax'
SELECT T2.Client_ID FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.`Submitted via` = 'Fax' AND T1.`Date received` = '2014-04-16'
{ "tables": [ "callcenterlogs", "events" ], "dimensions": [ "events.Client_ID" ], "_source": "sqlite", "filters": [ "events.\"Submitted via\" = 'Fax'", "callcenterlogs.\"Date received\" = '2014-04-16'", "callcenterlogs.\"Complaint ID\" = events.\"Complaint ID\"" ] }
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID, issue ) # client ( client_id ( e.g., `alias: name`, etc. ), ...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
List date of the review of the Eagle Capital from Indianapolis, Indiana.
List date of the review of the Eagle Capital from Indianapolis, Indiana.
Eagle Capital refers to Product = 'Eagle Capital'; Indianapolis refers to city = 'Indianapolis'; Indiana refers to state_abbrev = 'IN'
SELECT T2.Date FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T2.Product = 'Eagle Capital' AND T1.city = 'Indianapolis' AND T1.state_abbrev = 'IN'
{ "tables": [ "district", "reviews" ], "dimensions": [ "date" ], "_source": "sqlite", "filters": [ "reviews.Product = 'Eagle Capital'", "district.city = 'Indianapolis'", "district.state_abbrev = 'IN'", "district.district_id = reviews.district_id" ] }
# reviews ( Date, Stars, Reviews, Product, district_id ) # events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID, iss...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Among the complaints received in year 2015, what is total number of complaints timely response and closed with an explanation?
Among the complaints received in year 2015, what is total number of complaints timely response and closed with an explanation?
in year 2015 refers to Date received LIKE '2015%'; timely response refers to Timely response?" = 'Yes'; closed with an explanation refers to Company response to consumer = 'Closed with explanation'
SELECT COUNT(T1.`Complaint ID`) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE strftime('%Y', T1.`Date received`) = '2015' AND T2.`Timely response?` = 'Yes' AND T2.`Company response to consumer` = 'Closed with explanation'
{ "tables": [ "callcenterlogs", "events" ], "measures": [ { "agg": "COUNT", "expr": "callcenterlogs.\"Complaint ID\"", "alias": "" } ], "_source": "sqlite", "filters": [ { "type": "time_filter", "field": "callcenterlogs.\"Date received\"", "unit": "YEA...
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID, issue ) # callcenterlogs ( Date received, Complaint ID, rand...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
List the product reviewed with 1 star on March 14, 2016 from Newton, Massachusetts.
List the product reviewed with 1 star on March 14, 2016 from Newton, Massachusetts.
1 star refers to Stars = 1; on March 14, 2016 refers to Date = '2016-03-14'; Newton refers to city = 'Newton'; Massachusetts refers to state_abbrev = 'MA'
SELECT T2.Product FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T1.city = 'Newton' AND T1.state_abbrev = 'MA' AND T2.Date = '2016-03-14' AND T2.Stars = 1
{ "tables": [ "district", "reviews" ], "dimensions": [ "reviews.Product" ], "_source": "sqlite", "filters": [ "district.city = 'Newton'", "district.state_abbrev = 'MA'", "reviews.Date = '2016-03-14'", "reviews.Stars = 1", "district.district_id = reviews.district_id" ] }
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID, issue ) # reviews ( Date, Stars, Reviews, Product, district_...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
In reviews for the Eagle National Bank product, how many of the 5 star reviews where from Nashville, Tennessee?
In reviews for the Eagle National Bank product, how many of the 5 star reviews where from Nashville, Tennessee?
5 star refers to Stars = 5; Nashville refers to city = 'Nashville'; Tennessee refers to state_abbrev = 'TN'
SELECT COUNT(T2.Stars) FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T1.city = 'Nashville' AND T1.state_abbrev = 'TN' AND T2.Product = 'Eagle National Mortgage' AND T2.Stars = 5
{ "tables": [ "district", "reviews" ], "measures": [ { "agg": "COUNT", "expr": "stars", "alias": "" } ], "_source": "sqlite", "filters": [ "district.city = 'Nashville'", "district.state_abbrev = 'TN'", "reviews.Product = 'Eagle National Mortgage'", "reviews....
# reviews ( Date, Stars, Reviews, Product, district_id ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # district ( district_id, city, state_abbrev, division )
true
simple
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, FOREIGN KEY (`rand...
retail_complains
Among the reviews from midwest region, what are the products that received 1 star?
Among the reviews from midwest region, what are the products that received 1 star?
1 star refers to Stars = 1
SELECT DISTINCT T3.Product FROM state AS T1 INNER JOIN district AS T2 ON T1.StateCode = T2.state_abbrev INNER JOIN reviews AS T3 ON T2.district_id = T3.district_id WHERE T1.Region = 'Midwest' AND T3.Stars = 1
{ "tables": [ "district", "reviews", "state" ], "dimensions": [ "reviews.Product" ], "_source": "sqlite", "is_distinct": true, "filters": [ "state.Region = 'Midwest'", "reviews.Stars = 1", "state.StateCode = district.state_abbrev", "district.district_id = reviews.district_i...
# reviews ( Date, Stars, Reviews, Product, district_id ) # callcenterlogs ( Date received, Complaint ID, rand client, phonefinal, vru+line, call_id, priority, type, outcome, server, ser_start, ser_exit, ser_time ) # client ( client_id ( e.g., `alias: name`, etc. ), sex, day, month, year, age, social, first, middle, las...
true
simple
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, FOREIGN KEY (`rand...
retail_complains
List the products involved in the complaints received on March 2017 via TOVA server.
List the products involved in the complaints received on March 2017 via TOVA server.
on March 2017 refers to Date received LIKE '%03%' AND Date received LIKE '2017%'
SELECT DISTINCT T2.Product FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T1.server = 'TOVA' AND T2.`Date received` LIKE '2017-03%'
{ "tables": [ "callcenterlogs", "events" ], "dimensions": [ "events.Product" ], "_source": "sqlite", "is_distinct": true, "filters": [ "callcenterlogs.server = 'TOVA'", "events.\"Date received\" LIKE '2017-03%'", "callcenterlogs.\"Complaint ID\" = events.\"Complaint ID\"" ] }
# events ( Date received, Product, Sub-product, Issue, Sub-issue, Consumer complaint narrative, Tags, Consumer consent provided?, Submitted via, Date sent to company, Company response to consumer, Timely response?, Consumer disputed?, Complaint ID, Client_ID, issue ) # callcenterlogs ( Date received, Complaint ID, rand...
true
simple
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, FOREIGN KEY (`rand...