question
stringlengths
24
325
sql
stringlengths
30
804
db_id
stringclasses
63 values
prompt
stringlengths
308
18.9k
question_id
int64
167
9.43k
difficulty
stringclasses
1 value
How many stars did "Eagle Capital" received from Little Rock on 2013/4/4?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many stars did "Eagle Capital" received from Little Rock on 2013/4/4?
267
For the client who made the complaint call "CR0217298", what was his/her birthday?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # For the client who made the complaint call "CR0217298", what was his/her birthday?
268
What was the phone of number of the client who made the complaint call "CR0100432" ?
SELECT T1.phone FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Complaint ID` = 'CR0100432'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What was the phone of number of the client who made the complaint call "CR0100432" ?
269
For all the complaint callers on 2017/3/27, what percentage of the clients are females?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # For all the complaint callers on 2017/3/27, what percentage of the clients are females?
270
What is the percentage of the complaint calls from Mr Mason Javen Lopez has got the consent provided by the customer?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the percentage of the complaint calls from Mr Mason Javen Lopez has got the consent provided by the customer?
271
How many priority urgent complaints were received in march of 2017? List the complaint ID of these complaints.
SELECT COUNT(`Complaint ID`) FROM callcenterlogs WHERE `Date received` LIKE '2017-01%' AND priority = ( SELECT MAX(priority) FROM callcenterlogs )
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many priority urgent complaints were received in march of 2017? List the complaint ID of these complaints.
272
Please list the full name, date of birth, and email id of the elderly clients in descending order of age.
SELECT first, middle, last, year, month , day, email FROM client WHERE age > 65 ORDER BY age DESC
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Please list the full name, date of birth, and email id of the elderly clients in descending order of age.
273
Which product got the most five stars, and how many?
SELECT T.Product, MAX(T.num) FROM ( SELECT Product, COUNT(Stars) AS num FROM reviews WHERE Stars = 5 GROUP BY Product ) T
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Which product got the most five stars, and how many?
274
List all the states in the South region.
SELECT state FROM state WHERE Region = 'South'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # List all the states in the South region.
275
What is the email id of clients whose calls were hung?
SELECT T1.email FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T2.outcome = 'HANG'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the email id of clients whose calls were hung?
276
Calculate the average age of clients from the Midwest region.
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Calculate the average age of clients from the Midwest region.
277
List the full name and phone number of clients who submitted the complaint via fax.
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # List the full name and phone number of clients who submitted the complaint via fax.
278
Find and list the names of districts which has below-average stars for 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 )
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Find and list the names of districts which has below-average stars for Eagle Capital.
279
In the calls from the mountain division, how many are from teenage clients?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # In the calls from the mountain division, how many are from teenage clients?
280
What is the number of complaints related to Credit cards came from female clients?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the number of complaints related to Credit cards came from female clients?
281
Among the clients born between 1980 and 2000, list the name of male clients who complained through referral.
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Among the clients born between 1980 and 2000, list the name of male clients who complained through referral.
282
What is the medium through which most complaints are registered in 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
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the medium through which most complaints are registered in Florida?
283
Calculate the average number of complaints received from New Bedford each year which are closed with explanation.
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`)
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Calculate the average number of complaints received from New Bedford each year which are closed with explanation.
284
What percentage of consumers from Houston disputed complaints?
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
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What percentage of consumers from Houston disputed complaints?
285
Find the number of service members who complained in 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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Find the number of service members who complained in Syracuse.
286
Among the calls from California, what percentage are priority 1?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Among the calls from California, what percentage are priority 1?
287
Calculate the difference in the average age of elderly and middle-aged clients in the Northeast region.
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 ON T1.district_id = T2.district_id INNER JOIN state AS T3 ON T2.state_abbrev = T3.StateCode WHERE T3.Region = 'Northeast'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Calculate the difference in the average age of elderly and middle-aged clients in the Northeast region.
288
List by their ID number the 3 longest complaints.
SELECT `Complaint ID` FROM callcenterlogs ORDER BY ser_time DESC LIMIT 3
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # List by their ID number the 3 longest complaints.
289
How many clients have an email account other than gmail.com?
SELECT COUNT(email) FROM client WHERE email NOT LIKE '%@gmail.com'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many clients have an email account other than gmail.com?
290
Identify by their ID all clients who did not give their consent permission.
SELECT Client_ID FROM events WHERE `Consumer consent provided?` = 'N/A' OR 'Consumer consent provided?' IS NULL OR 'Consumer consent provided?' = ''
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Identify by their ID all clients who did not give their consent permission.
291
List by their ID the complaints received by the company on 25/09/2014 that took the longest.
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # List by their ID the complaints received by the company on 25/09/2014 that took the longest.
292
List priority 2 complaints by date received.
SELECT DISTINCT `Complaint ID` FROM callcenterlogs WHERE priority = 2 ORDER BY `Date received` DESC
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # List priority 2 complaints by date received.
293
How many complaints are not in process with an agent?
SELECT COUNT(outcome) FROM callcenterlogs WHERE outcome != 'AGENT'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many complaints are not in process with an agent?
294
How many Credit Card complaints did Sharon handle?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many Credit Card complaints did Sharon handle?
295
In which region have the most 1-star reviews been done?
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
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # In which region have the most 1-star reviews been done?
296
In what years were the clients who demanded more problems with Certificate of deposit born?
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
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # In what years were the clients who demanded more problems with Certificate of deposit born?
297
How many cases of billing dispute issues occurred in the Mountain division?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many cases of billing dispute issues occurred in the Mountain division?
298
How many male clients are from the state of Massachusetts?
SELECT COUNT(T3.sex) FROM state AS T1 INNER JOIN district AS T2 ON T1.StateCode = T2.state_abbrev INNER JOIN client AS T3 ON T2.district_id = T3.district_id WHERE T1.state = 'Massachusetts' AND T3.sex = 'Male'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many male clients are from the state of Massachusetts?
299
Lists the last name of all clients who made a PS-type complaint and were served by TOVA.
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Lists the last name of all clients who made a PS-type complaint and were served by TOVA.
300
How many clients under the age of 35 gave Eagle National Mortgage 1 star?
SELECT COUNT(T2.age) FROM reviews AS T1 INNER JOIN client AS T2 ON T1.district_id = T2.district_id WHERE T1.Product = 'Eagle National Mortgage' AND T1.Stars = 1 AND T2.age < 35
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many clients under the age of 35 gave Eagle National Mortgage 1 star?
301
How many male clients born in the year 1977 were given priority 0 in their complaints?
SELECT COUNT(T1.sex) FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T1.sex = 'Male' AND T2.priority = 0 AND T1.year = 1997
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many male clients born in the year 1977 were given priority 0 in their complaints?
302
List by name all customers who provided consent for the tag Older American.
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.Tags = 'Older American' AND T2.`Consumer consent provided?` != 'N/A' AND T2.`Consumer consent provided?` IS NOT NULL AND T2.`Consumer consent provided?` != ''
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # List by name all customers who provided consent for the tag Older American.
303
What is the name of the state in which there have been the largest number of complaints with 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
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the name of the state in which there have been the largest number of complaints with priority 0?
304
How many complaints made by women and served after 3 pm received a timely response from the company?
SELECT COUNT(T1.`Complaint ID`) 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.sex = 'Female' AND T1.ser_start BETWEEN '15:00:01' AND '23:59:59' AND T3.`Timely response?` = 'Yes'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many complaints made by women and served after 3 pm received a timely response from the company?
305
How many complaints were served in 5 minutes or less by DORIT and responded to the customer with an explanation, were made by phone?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many complaints were served in 5 minutes or less by DORIT and responded to the customer with an explanation, were made by phone?
306
How many clients with the last name Alvarado are from Maryland?
SELECT COUNT(T2.client_id) FROM district AS T1 INNER JOIN client AS T2 ON T1.district_id = T2.district_id INNER JOIN state AS T3 ON T1.state_abbrev = T3.StateCode WHERE T2.last = 'Alvarado' AND T2.state = 'MD'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many clients with the last name Alvarado are from Maryland?
307
How many reviews by people between 30 and 50 years include the word '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%'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many reviews by people between 30 and 50 years include the word 'great'?
308
What is the full address of the customers who, having received a timely response from the company, have dispute about that response?
SELECT T1.address_1, T1.address_2 FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Timely response?` = 'Yes' AND T2.`Consumer disputed?` = 'Yes'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the full address of the customers who, having received a timely response from the company, have dispute about that response?
309
How many complaints from female clients born in the year 2000 were not sent through the web?
SELECT COUNT(T2.`Submitted via`) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.sex = 'Female' AND T1.year = 2000 AND T2.`Submitted via` != 'Web'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many complaints from female clients born in the year 2000 were not sent through the web?
310
List all the complaints narratives made by the customer named Brenda and last name Mayer.
SELECT T2.`Consumer complaint narrative` FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Brenda' AND T1.last = 'Mayer'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # List all the complaints narratives made by the customer named Brenda and last name Mayer.
311
How many complaints from customers with a gmail.com email were received by the company in February 2017?
SELECT COUNT(T1.email) FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE (T2.`Date received` LIKE '2017-02%' OR T2.`Date received` LIKE '2017-01%') AND T1.email LIKE '%@gmail.com'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many complaints from customers with a gmail.com email were received by the company in February 2017?
312
What is the average number of stars given by Oregon clients in their reviews?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the average number of stars given by Oregon clients in their reviews?
313
What percentage of clients who sent their complaints by postal mail are age 50 and older?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What percentage of clients who sent their complaints by postal mail are age 50 and older?
314
What is the average age of Norwalk clients?
SELECT CAST(SUM(T1.age) AS REAL) / COUNT(T1.age) AS average FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.city = 'Norwalk'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the average age of Norwalk clients?
315
How many clients who live in Kansas City provided a 1-star review?
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
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many clients who live in Kansas City provided a 1-star review?
316
Which state has the highest number of clients who gave a 5-star review?
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
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Which state has the highest number of clients who gave a 5-star review?
317
Which region does Noah Thompson live in?
SELECT T2.division FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.first = 'Noah' AND T1.last = 'Thompson'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Which region does Noah Thompson live in?
318
How did Kyran Muller submit his complaint?
SELECT DISTINCT T2.`Submitted via` FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Kyran' AND T1.last = 'Muller'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How did Kyran Muller submit his complaint?
319
What are the products that people who were born after 2005 complain about?
SELECT DISTINCT T2.Product FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.year > 2005
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What are the products that people who were born after 2005 complain about?
320
How long was Kendall Allen's complaint about her credit card?
SELECT T3.ser_time FROM events AS T1 INNER JOIN client AS T2 ON T1.Client_ID = T2.client_id INNER JOIN callcenterlogs AS T3 ON T1.`Complaint ID` = T3.`Complaint ID` WHERE T2.first = 'Kendall' AND T2.last = 'Allen' AND T2.sex = 'Female' AND T1.Product = 'Credit card'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How long was Kendall Allen's complaint about her credit card?
321
What was the issue that the client with the longest server time faced?
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 )
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What was the issue that the client with the longest server time faced?
322
How many clients who live in New York City submitted their complaints 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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many clients who live in New York City submitted their complaints via fax?
323
What is the percentage of male clients complaining about their credit cards?
SELECT CAST(SUM(CASE WHEN T1.sex = 'Male' 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.Product = 'Credit card'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the percentage of male clients complaining about their credit cards?
324
Please list any two clients with their full names who have been tagged as "Older American" by the company without seeking their permission.
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.Tags = 'Older American' AND T2.`Consumer consent provided?` IN (NULL, 'N/A', '') LIMIT 2
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Please list any two clients with their full names who have been tagged as "Older American" by the company without seeking their permission.
325
What is the birth date of the youngest client?
SELECT day, month, year FROM client ORDER BY year DESC, month DESC, day DESC LIMIT 1
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the birth date of the youngest client?
326
How many times does the consumer have no dispute over a non-timely response from the company?
SELECT COUNT(`Timely response?`) FROM events WHERE `Timely response?` = 'No' AND `Consumer disputed?` = 'No'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many times does the consumer have no dispute over a non-timely response from the company?
327
How many of the complaints are longer than 15 minutes?
SELECT COUNT(ser_time) FROM callcenterlogs WHERE strftime('%M', ser_time) > '15'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many of the complaints are longer than 15 minutes?
328
What is the most common issue for the highest priority complaints?
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
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the most common issue for the highest priority complaints?
329
List the full names of all clients who live in the Pacific division.
SELECT T2.first, T2.middle, T2.last FROM district AS T1 INNER JOIN client AS T2 ON T1.district_id = T2.district_id WHERE T1.division = 'Pacific'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # List the full names of all clients who live in the Pacific division.
330
What is the social number of the person who made the most complaints?
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
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the social number of the person who made the most complaints?
331
Which is the city where most of the 1 star reviews come from?
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
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Which is the city where most of the 1 star reviews come from?
332
What is the address of the client who made a complaint via postal mail on March 14, 2012?
SELECT T1.address_1, T1.address_2 FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Date received` = '2012-03-14' AND T2.`Submitted via` = 'Postal mail'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the address of the client who made a complaint via postal mail on March 14, 2012?
333
Among the female clients, how many of them have a complaint with a priority of 1?
SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T1.sex = 'Female' AND T2.priority = 1
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Among the female clients, how many of them have a complaint with a priority of 1?
334
List all the server of the phone complaints with a late response from the company.
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # List all the server of the phone complaints with a late response from the company.
335
List all the issues of the complaints made by Kaitlyn Eliza Elliott.
SELECT DISTINCT T2.Issue FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Kaitlyn' AND T1.middle = 'Eliza' AND T1.last = 'Elliott'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # List all the issues of the complaints made by Kaitlyn Eliza Elliott.
336
What is the name of the state that the client with the email "skylar.ramirez@gmail.com" lives in?
SELECT T3.state FROM state AS T1 INNER JOIN district AS T2 ON T1.StateCode = T2.state_abbrev INNER JOIN client AS T3 ON T2.district_id = T3.district_id WHERE T3.email = 'skylar.ramirez@gmail.com'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the name of the state that the client with the email "skylar.ramirez@gmail.com" lives in?
337
Which region has the second most clients?
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
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Which region has the second most clients?
338
Who is the owner of the final phone number for the complaints on server "MORIAH" on 9/11/2013?
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.server = 'MORIAH' AND T2.`Date received` = '2013-09-11'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Who is the owner of the final phone number for the complaints on server "MORIAH" on 9/11/2013?
339
Compute the average time in minute for each age group
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 * strftime('%H', ser_time) + strftime('%M', ser_time) + strftime('%S', ser_time) / 60 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.age > 19 AND T1.age <= 65 THEN 1 ELSE 0 END) AS adultAverageMins , CAST(SUM(CASE WHEN T1.age > 65 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 > 65 THEN 1 ELSE 0 END) AS elderAverageMins FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client`
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Compute the average time in minute for each age group
340
What percentage of complaints are from the elderly?
SELECT CAST(SUM(CASE WHEN T1.age > 65 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.age) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What percentage of complaints are from the elderly?
341
Calculate the percentage of male clients from Indianapolis City.
SELECT CAST(SUM(CASE WHEN sex = 'Male' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(client_id) FROM client WHERE city = 'Indianapolis'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Calculate the percentage of male clients from Indianapolis City.
342
Among the teenager clients who use Google account and Microsoft account, which group of client is more than the other?
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
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Among the teenager clients who use Google account and Microsoft account, which group of client is more than the other?
343
What is the full name of client whose email address is emily.garcia43@outlook.com?
SELECT first, middle, last FROM client WHERE email = 'emily.garcia43@outlook.com'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the full name of client whose email address is emily.garcia43@outlook.com?
344
What is the first name of clients who have the highest priority?
SELECT T1.first FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T2.priority = ( SELECT MAX(priority) FROM callcenterlogs )
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the first name of clients who have the highest priority?
345
List down the email of client whose complaint is type "PS".
SELECT T1.email FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T2.type = 'PS'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # List down the email of client whose complaint is type "PS".
346
Among the elderlies, state the last name of whose complaint is handled in server YIFAT?
SELECT T1.last FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T1.age > 65 AND T2.server = 'YIFAT'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Among the elderlies, state the last name of whose complaint is handled in server YIFAT?
347
How many clients who live in New York City have the complaint outcome as "AGENT"?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # How many clients who live in New York City have the complaint outcome as "AGENT"?
348
List down the full name of clients who have disputed the response from company.
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.`Consumer disputed?` = 'Yes'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # List down the full name of clients who have disputed the response from company.
349
What are the complaint id of client who were born in 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
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What are the complaint id of client who were born in 1931?
350
Calculate the percentage of complaints made by Google account client in server ZOHARI.
SELECT CAST(SUM(CASE WHEN T1.email LIKE '%@gmail.com' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.email) FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T2.server = 'ZOHARI'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Calculate the percentage of complaints made by Google account client in server ZOHARI.
351
State the full name of clients with server time of 20 minutes and above.
SELECT T1.first, T1.middle, T1.last FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE strftime('%M', T2.ser_time) > '20'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # State the full name of clients with server time of 20 minutes and above.
352
Pick 5 clients with 0 priority and write down their last name.
SELECT T1.last FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T2.priority = 0 LIMIT 5
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Pick 5 clients with 0 priority and write down their last name.
353
Write down the call id of clients whose first name start with alphabet "B".
SELECT T2.call_id FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T1.first LIKE 'B%'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Write down the call id of clients whose first name start with alphabet "B".
354
What is the product complained by Alexander Bronx Lewis?
SELECT DISTINCT T2.Product FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.first = 'Alexander' AND T1.middle = 'Bronx' AND T1.last = 'Lewis'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the product complained by Alexander Bronx Lewis?
355
State the first name of male clients who did not receive timely response from the call center.
SELECT T1.first FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Timely response?` = 'No' AND T1.sex = 'Male'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # State the first name of male clients who did not receive timely response from the call center.
356
Which product received the most complaints from elder clients?
SELECT T2.Product FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.age > 65 ORDER BY T1.client_id DESC LIMIT 1
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Which product received the most complaints from elder clients?
357
Complaint about Credit Card mostly came from clients of which age group?
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Complaint about Credit Card mostly came from clients of which age group?
358
List down the issues for complaint with server time of below 10 minutes.
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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # List down the issues for complaint with server time of below 10 minutes.
359
Write down the date received of complaints sent 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'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Write down the date received of complaints sent via Fax.
360
What is the full name of clients who have issue about balance transfer?
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.Issue = 'Balance transfer'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the full name of clients who have issue about balance transfer?
361
What is the email address of clients who submitted their complaints via postal mail?
SELECT T1.email FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Submitted via` = 'Postal mail'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the email address of clients who submitted their complaints via postal mail?
362
Calculate the average age of clients whose response is "Closed with relief".
SELECT AVG(T1.age) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Company response to consumer` = 'Closed with relief'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Calculate the average age of clients whose response is "Closed with relief".
363
What is the average age of clients whose complaint type is "TT"?
SELECT AVG(T1.age) FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T2.type = 'TT'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # What is the average age of clients whose complaint type is "TT"?
364
Write the complaint ID, call ID, and final phone number of complaints through AVIDAN server from 1/1/2014 to 12/30/2014.
SELECT `Complaint ID`, call_id, phonefinal FROM callcenterlogs WHERE strftime('%Y', `Date received`) = '2014' AND server = 'AVIDAN'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Write the complaint ID, call ID, and final phone number of complaints through AVIDAN server from 1/1/2014 to 12/30/2014.
365
Between 1/1/2017 and 4/1/2017, what is the average server time of calls under the server DARMON?
SELECT AVG(CAST(SUBSTR(ser_time, 4, 2) AS REAL)) FROM callcenterlogs WHERE `Date received` BETWEEN '2017-01-01' AND '2017-04-01'
retail_complains
Database Schema: callcenterlogs (Date received date, Complaint ID text, rand client text, phonefinal text, vru+line text, call_id integer, priority integer, type text, outcome text, server text, ser_start text, ser_exit text, ser_time text, , PRIMARY KEY(Complaint ID), FOREIGN KEY(rand client) REFERENCES client(client_id)) #client (client_id text, sex text, day integer, month integer, year integer, age integer, social text, first text, middle text, last text, phone text, email text, address_1 text, address_2 text, city text, state text, zipcode integer, district_id integer, , PRIMARY KEY(client_id), FOREIGN KEY(district_id) REFERENCES district(district_id)) #district (district_id integer, city text, state_abbrev text, division text, , PRIMARY KEY(district_id), FOREIGN KEY(state_abbrev) REFERENCES state(StateCode)) #events (Date received date, Product text, Sub-product text, Issue text, Sub-issue text, Consumer complaint narrative text, Tags text, Consumer consent provided? text, Submitted via text, Date sent to company text, Company response to consumer text, Timely response? text, Consumer disputed? text, Complaint ID text, Client_ID text, , PRIMARY KEY(Complaint ID), PRIMARY KEY(Client_ID), FOREIGN KEY(Client_ID) REFERENCES client(client_id), FOREIGN KEY(Complaint ID) REFERENCES callcenterlogs(Complaint ID)) #reviews (Date date, Stars integer, Reviews text, Product text, district_id integer, , PRIMARY KEY(Date), FOREIGN KEY(district_id) REFERENCES district(district_id)) #state (StateCode text, State text, Region text, , PRIMARY KEY(StateCode), ) # Between 1/1/2017 and 4/1/2017, what is the average server time of calls under the server DARMON?
366