Chinastark/bird_dataset huggingface dataset:
Database: book_publishing_company
Question: Find the difference between the average royalty of titles published by US and non US publishers?
Evidence: 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'))
SQL: 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 ON T1.pub_id = T2.pub_id INNER JOIN roysched AS T3 ON T1.title_id = T3.title_id
Database: book_publishing_company
Question: Calculate the average level difference between the Marketing editors hired by the US and non-US publishers?
Evidence: 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)
SQL: 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.pub_id = T2.pub_id INNER JOIN jobs AS T3 ON T2.job_id = T3.job_id WHERE T3.job_desc = 'Managing Editor'
Database: book_publishing_company
Question: 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?
Evidence: publisher refers to pub_name; about the title refers to notes
SQL: 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.'
Database: book_publishing_company
Question: 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?
Evidence: year to date sales refers to ytd_sales; about the title refers to notes
SQL: 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.'
Database: book_publishing_company
Question: Name the top five titles that sold more than average and list them in descending order of the number of sales in California stores?
Evidence: qty is abbreviation for quantity; sold more than average refers to qty > AVG(qty); california refers to state = 'CA"
SQL: 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
Database: retail_complains
Question: On which day was the most verbose complaint received?
Evidence: day received refers to "Date received"; most verbose complaint refers to MAX(ser_time);
SQL: SELECT `Date received` FROM callcenterlogs WHERE ser_time = ( SELECT MAX(ser_time) FROM callcenterlogs )
Database: retail_complains
Question: When did the earliest complaint start on 2017/3/22?
Evidence: earliest complaint refers to oldest ser_start; on 2017/3/22 refers to "Date received" = '2017-03-22';
SQL: SELECT MIN(ser_time) FROM callcenterlogs WHERE `Date received` = '2017-03-22'
Database: retail_complains
Question: Which complaint is more urgent, complaint ID CR2400594 or ID CR2405641?
Evidence: more urgent refers to MAX(priority);
SQL: SELECT CASE WHEN SUM(CASE WHEN `Complaint ID` = 'CR2400594' THEN priority END) > SUM(CASE WHEN `Complaint ID` = 'CR2405641' THEN priority END) THEN 'CR2400594' ELSE 'CR2405641' END FROM callcenterlogs
Database: retail_complains
Question: Please list the full names of all the male clients born after the year 1990.
Evidence: full names = first, middle, last; male refers to sex = 'Male'; year > 1990;
SQL: SELECT first, middle, last FROM client WHERE year > 1990
Database: retail_complains
Question: How many complaints have the client Diesel Galloway filed?
SQL: SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Diesel' AND T1.last = 'Galloway'
Database: retail_complains
Question: What is the detailed product of the complaint filed by Diesel Galloway on 2014/7/3?
Evidence: detailed product refers to "sub-product"; on 2014/7/3 refers to "Date received" = '2014-07-03';
SQL: SELECT T2.`Sub-product` FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Diesel' AND T1.last = 'Galloway' AND T2.`Date received` = '2014-07-03'
Database: retail_complains
Question: Was the tag in the complaint filed by Matthew Pierce on 2016/10/28 approved by himself?
Evidence: on 2016/10/28 refers to Date received = '2016-10-28'; "Consumer consent provided?" in (null, 'N/A', 'Empty') means that the company didn't get the permission of consent; "Consumer consent provided?" not in (null, 'N/A', 'Empty') means that customers provide the consent for this tag;
SQL: SELECT CASE WHEN T2.`Consumer consent provided?` IN (NULL, 'N/A', 'Empty') THEN 'No' ELSE 'Yes' END FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Matthew' AND T1.last = 'Pierce' AND T2.`Date received` = '2016-10-28'
Database: retail_complains
Question: For how long was the complaint filed by Matthew Pierce on 2016/10/28 delayed?
Evidence: on 2016/10/28 refers to "Date received" = '2016-10-28'; delayed = SUBTRACT("Date sent to company', 'Date received");
SQL: SELECT 365 * (strftime('%Y', T2.`Date sent to company`) - strftime('%Y', T2.`Date received`)) + 30 * (strftime('%M', T2.`Date sent to company`) - strftime('%M', T2.`Date received`)) + (strftime('%d', T2.`Date sent to company`) - strftime('%d', T2.`Date received`)) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Matthew' AND T1.last = 'Pierce' AND T2.`Date received` = '2016-10-28'
Database: retail_complains
Question: What is the full name of the client whose complaint on 2017/3/27 was received by MICHAL?
Evidence: full names = first, middle, last; on 2017/3/27 refers to "Date received" = '2017-03-27'; MICHAL refers to server = 'MICHAL';
SQL: SELECT T1.first, T1.middle, T1.last FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T2.`Date received` = '2017-03-27' AND T2.server = 'MICHAL'
Database: retail_complains
Question: For how long did the complaint filed on 2017/3/27 by Rachel Hicks last?
Evidence: how long did the complaint filed last refers to ser_time; on 2017/3/27 refers to "Date received" = '2017-03-27';
SQL: SELECT T2.ser_time FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T1.first = 'Rachel' AND T1.last = 'Hicks' AND T2.`Date received` = '2017-03-27'
Database: retail_complains
Question: Among all the clients from the New York city, how many of them have filed a complaint on the issue of Deposits and withdrawals?
SQL: SELECT COUNT(T2.Issue) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.Issue = 'Deposits and withdrawals' AND T1.city = 'New York City'
Database: retail_complains
Question: Please list the full names of all the clients whose complaints are still in progress.
Evidence: full name = first, middle, last; complaints are still in progress refers to "Company response to consumer" = 'In progress';
SQL: SELECT T1.first, T1.middle, T1.last FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Company response to consumer` = 'In progress'
Database: retail_complains
Question: Among the clients who did receive a timely response for their complaint, how many of them are from New York?
Evidence: did not receive a timely response refers to "Timely response?" = 'No'; New York refers to city = 'New York';
SQL: SELECT COUNT(T1.city) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Timely response?` = 'No' AND T1.city = 'New York City'
Database: retail_complains
Question: How many complaints on credit cards in the year 2016 were filed by male clients?
Evidence: credit cards refers to Product = 'Credit card'; 2016 refers to year(Date received) = 2016; male refers to sex = 'Male';
SQL: SELECT COUNT(T1.sex) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE strftime('%Y', T2.`Date received`) = '2016' AND T1.sex = 'Male' AND T2.Product = 'Credit card'
Database: retail_complains
Question: Which division is Diesel Galloway in?
SQL: SELECT T2.division FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.first = 'Diesel' AND T1.last = 'Galloway'
Database: retail_complains
Question: Please list the full names of all the male clients in the Pacific division.
Evidence: full names = first, middle, last; male refers to sex = 'Male';
SQL: SELECT T1.first, T1.middle, T1.last FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.division = 'Pacific' AND T1.sex = 'Male'
Database: retail_complains
Question: What is the average number of complaints on credit cards filed by clients from New York in the 3 consecutive years starting from 2015?
Evidence: 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;
SQL: 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'
Database: retail_complains
Question: What is the percentage of the increase of complaints filed by the clients from New York from the year 2016 to the year 2017?
Evidence: percentage of increase = MULTIPLY(DIVIDE(SUBTRACT(SUM(year("Date received") = 2017), SUM(year("Date received") = 2016)), SUM(year("Date received") = 2016)), 1.0); New York refers to city = 'New York'; year("Date received") BETWEEN 2016 AND 2017;
SQL: SELECT 100.0 * (SUM(CASE WHEN strftime('%Y', T2.`Date received`) = '2017' THEN 1 ELSE 0 END) - SUM(CASE WHEN strftime('%Y', T2.`Date received`) = '2016' THEN 1 ELSE 0 END)) / SUM(CASE WHEN strftime('%Y', T2.`Date received`) = '2016' THEN 1 ELSE 0 END) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.city = 'New York City'
Database: retail_complains
Question: What was the serve time for the complaint call from client "C00007127" on 2017/2/22?
Evidence: 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';
SQL: 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'
Database: retail_complains
Question: Which state does the owner of "wyatt.collins@gmail.com" live in? Give the full name of the state.
Evidence: full name of the state refers to state_name;
SQL: SELECT T1.state FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.email = 'wyatt.collins@gmail.com'
Database: retail_complains
Question: Which detailed product did Mr Lennox Oliver Drake complain about?
Evidence: detailed product refers to "Sub-product"; Mr refers to sex = 'Male';
SQL: SELECT DISTINCT T2.`Sub-product` FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Lennox' AND T1.middle = 'Oliver' AND T1.last = 'Drake' AND T1.sex = 'Male'
Database: retail_complains
Question: What was the detailed issue did Mr Gunner Omer Fuller complain about?
Evidence: detailed issue refers to Sub-issue; Mr refers to sex = 'Male';
SQL: SELECT T2.`Sub-issue` FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Gunner' AND T1.middle = 'Omer' AND T1.last = 'Fuller' AND T1.sex = 'Male'
Database: retail_complains
Question: Did Ms. Lyric Emely Taylor provide the consent for result of the complaint call on 2016/5/20?
Evidence: Ms refers to sex = 'Female'; "Consumer consent provided?" in (null, 'N/A', 'Empty') means that the company didn't get the permission of consent; "Consumer consent provided?" not in (null, 'N/A', 'Empty') means the customers provide the consent; on 2016/5/20 refers to Date received = '2016-05-20';
SQL: SELECT CASE WHEN T2.`Consumer consent provided?` IN (NULL, 'N/A', '') THEN 'No' ELSE 'Yes' END FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Lyric' AND T1.middle = 'Emely' AND T1.last = 'Taylor' AND T1.sex = 'Female' AND T2.`Date received` = '2016-05-20'
Database: retail_complains
Question: How many days delay for the complaint call from Mr. Brantley Julian Stanley on 2012/5/18?
Evidence: days delay for the complaint = SUBTRACT("date sent to company", "Date received"); Mr refers to sex = 'Male'; on 2012/5/18 refers to "Date received" = '2012-05-18';
SQL: SELECT 365 * (strftime('%Y', T2.`Date sent to company`) - strftime('%Y', T2.`Date received`)) + 30 * (strftime('%M', T2.`Date sent to company`) - strftime('%M', T2.`Date received`)) + (strftime('%d', T2.`Date sent to company`) - strftime('%d', T2.`Date received`)) AS days FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Date received` = '2012-05-18' AND T1.sex = 'Male' AND T1.first = 'Brantley' AND T1.middle = 'Julian' AND T1.last = 'Stanley'
Database: retail_complains
Question: Which district did the review on 2018/9/11 come from? Give the name of the city.
Evidence: on 2018/9/11 refers to Date = '2017-07-22';
SQL: SELECT T2.district_id, T2.city FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.Date = '2018-09-11'
Database: retail_complains
Question: What was the review context from Jacksonville on 2017/7/22?
Evidence: Jacksonville refers to city = 'Jacksonville'; on 2017/7/22 refers to Date = '2017-07-22';
SQL: SELECT T1.Reviews FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.city = 'Jacksonville' AND T1.Date = '2017-07-22'
Database: retail_complains
Question: Which product received a review from Indianapolis on 2016/10/7?
Evidence: Indianapolis refers to state = 'Indianapolis'; on 2016/10/7 refers to Date = '2013-04-04';
SQL: 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'
Database: retail_complains
Question: How many stars did "Eagle Capital" received from Little Rock on 2013/4/4?
Evidence: Eagle Capital refers to Product = 'Eagle Capital'; Little Rock is a city; on 2013/4/4 refers to Date = '2013-04-04';
SQL: 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'
Database: retail_complains
Question: For the client who made the complaint call "CR0217298", what was his/her birthday？
Evidence: complaint call refers to Complaint ID; birthday = year, month, day;
SQL: 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'
Database: retail_complains
Question: What was the phone of number of the client who made the complaint call "CR0100432" ？
Evidence: complaint call refers to Complaint ID;
SQL: SELECT T1.phone FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Complaint ID` = 'CR0100432'
Database: retail_complains
Question: For all the complaint callers on 2017/3/27, what percentage of the clients are females?
Evidence: on 2017/3/27 refers to "Date received" = '2017-03-27'; percentage = MULTIPLY(DIVIDE(SUM(sex = 'Female' ), COUNT(client_id)), 1.0); females refers to sex = 'Female';
SQL: SELECT CAST(SUM(CASE WHEN T1.sex = 'Female' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.sex) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Date received` = '2017-03-27'
Database: retail_complains
Question: What is the percentage of the complaint calls from Mr Mason Javen Lopez has got the consent provided by the customer?
Evidence: percentage = MULTIPLY(DIVIDE(SUM("Consumer consent provided?" = 'Consent provided'), COUNT(client_id)), 1.0); Mr refers to sex = 'Male'; consent provided by the customer refers to "Consumer consent provided?" = 'Consent provided';
SQL: SELECT CAST(SUM(CASE WHEN T2.`Consumer consent provided?` = 'Consent provided' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.`Consumer consent provided?`) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.sex = 'Male' AND T1.first = 'Mason' AND T1.middle = 'Javen' AND T1.last = 'Lopez'
Database: retail_complains
Question: How many priority urgent complaints were received in march of 2017? List the complaint ID of these complaints.
Evidence: urgent complaints refers to priority = 2; march of 2017 refers to "Date received" BETWEEN '2017-01-01' AND '2017-01-31';
SQL: SELECT COUNT(`Complaint ID`) FROM callcenterlogs WHERE `Date received` LIKE '2017-01%' AND priority = ( SELECT MAX(priority) FROM callcenterlogs )
Database: retail_complains
Question: Please list the full name, date of birth, and email id of the elderly clients in descending order of age.
Evidence: full name = first, middle, last; date of birth = year, month, day; elderly clients refers to age > 65;
SQL: SELECT first, middle, last, year, month , day, email FROM client WHERE age > 65 ORDER BY age DESC
Database: retail_complains
Question: Which product got the most five stars, and how many?
Evidence: most five stars refers to MAX(COUNT(stars = 5));
SQL: SELECT T.Product, MAX(T.num) FROM ( SELECT Product, COUNT(Stars) AS num FROM reviews WHERE Stars = 5 GROUP BY Product ) T
Database: retail_complains
Question: List all the states in the South region.
SQL: SELECT state FROM state WHERE Region = 'South'
Database: retail_complains
Question: What is the email id of clients whose calls were hung?
Evidence: email id refers to email; calls were hung refers to outcome = 'Hang';
SQL: SELECT T1.email FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T2.outcome = 'HANG'
Database: retail_complains
Question: Calculate the average age of clients from the Midwest region.
Evidence: average age = AVG(age);
SQL: 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'
Database: retail_complains
Question: List the full name and phone number of clients who submitted the complaint via fax.
Evidence: full name = first, middle, last; submitted the complaint via fax refers to "Submitted via" = 'fax';
SQL: SELECT T1.first, T1.middle, T1.last, T1.phone FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Submitted via` = 'Fax'
Database: retail_complains
Question: Find and list the names of districts which has below-average stars for Eagle Capital.
Evidence: below average = AVG(stars) < Stars; Eagle Capital refers to Product = 'Eagle Capital';
SQL: 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 )
Database: retail_complains
Question: In the calls from the mountain division, how many are from teenage clients?
Evidence: teenage refers to age BETWEEN 12 AND 20;
SQL: SELECT COUNT(T1.age) FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.age BETWEEN 12 AND 20 AND T2.division = 'Mountain'
Database: retail_complains
Question: What is the number of complaints related to Credit cards came from female clients?
Evidence: Credit cards refers to Product = 'Credit card'; female refers to sex = 'female';
SQL: SELECT COUNT(T1.sex) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.sex = 'Female' AND T2.Product = 'Credit card'
Database: retail_complains
Question: Among the clients born between 1980 and 2000, list the name of male clients who complained through referral.
Evidence: born between 1980 and 2000 refers to year BETWEEN 1980 AND 2000; name = first, middle, last; male refers to sex = 'Male'; complained through refers to "Submitted via";
SQL: SELECT T1.first, T1.middle, T1.last FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.year BETWEEN 1980 AND 2000 AND T1.sex = 'Male' AND T2.`Submitted via` = 'Referral'
Database: retail_complains
Question: What is the medium through which most complaints are registered in Florida?
Evidence: medium refers to "Submitted via"; most complaints refers to MAX(Complaint ID); Florida refers to state = 'florida';
SQL: 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
Database: retail_complains
Question: Calculate the average number of complaints received from New Bedford each year which are closed with explanation.
Evidence: average = AVG("Complaint ID"); New Bedford refers to city = 'New Bedford'; closed with explanation refers to Company response to consumer = 'Closed with explanation';
SQL: SELECT STRFTIME('%Y', T3.`Date received`) , CAST(SUM(CASE WHEN T3.`Company response to consumer` = 'Closed with explanation' THEN 1 ELSE 0 END) AS REAL) / COUNT(T3.`Complaint ID`) AS average 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.city = 'New Bedford' GROUP BY strftime('%Y', T3.`Date received`)
Database: retail_complains
Question: What percentage of consumers from Houston disputed complaints?
Evidence: percentage = MULTIPLY(DIVIDE(SUM("Consumer disputed?" = 'Yes' AND city = 'Houston'), COUNT(client_id)), 1.0); Houston refers to city = 'Houston';
SQL: 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
Database: retail_complains
Question: Find the number of service members who complained in Syracuse.
Evidence: service members refers to client.client_id; Syracuse refers to city = 'Syracuse';
SQL: 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'
Database: retail_complains
Question: Among the calls from California, what percentage are priority 1?
Evidence: California refers to state = 'California'; percentage = MULTIPLY(DIVIDE(SUM(priority = 1), COUNT("Complaint ID"), 1.0));
SQL: 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 = 'California'