db_id
stringclasses
69 values
question
stringlengths
24
325
evidence
stringlengths
0
673
SQL
stringlengths
23
804
difficulty
stringclasses
1 value
question_id
int64
0
9.43k
sql_constructs
listlengths
2
17
sql_complexity
int64
2
46
sql_complexity_buckets
stringclasses
3 values
sqlglot_schema
stringclasses
69 values
table_in_sql
listlengths
1
6
column_in_sql
listlengths
1
25
columns_used_to_join_in_sql
listlengths
0
10
schema
dict
schema_no_exp
dict
retail_complains
Lists the last name of all clients who made a PS-type complaint and were served by TOVA.
PS-type complaint refers to type = 'PS'; served by refers to server;
SELECT t1.last FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T2.type = 'PS' AND T2.server = 'TOVA'
na
300
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.server", "callcenterlogs.type", "client.client_id", "client.last" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many clients under the age of 35 gave Eagle National Mortgage 1 star?
age < 35; Eagle National Mortgage refers to Product = 'Eagle National Mortgage';
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
na
301
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
9
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "reviews" ]
[ "client.age", "client.district_id", "reviews.district_id", "reviews.product", "reviews.stars" ]
[ "client.district_id", "reviews.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many male clients born in the year 1977 were given priority 0 in their complaints?
male refers to sex = 'Male';
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
na
302
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
9
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.priority", "client.client_id", "client.sex", "client.year" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
List by name all customers who provided consent for the tag Older American.
name refers to first; provided consent refers to "Consumer consent provided?" not in ('N/A', null, 'empty');
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?` != ''
na
303
[ "AS", "AND", "SELECT", "/", "NULL", "INNER JOIN", "ON", "NOT", "IS", "FROM" ]
13
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.first", "client.last", "client.middle", "events.\"consumer consent provided?\"", "events.client_id", "events.tags" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the name of the state in which there have been the largest number of complaints with priority 0?
largest number of complaints refers to MAX(COUNT("Complaint ID") WHERE priority = 0);
SELECT T2.state FROM callcenterlogs AS T1 INNER JOIN client AS T2 ON T1.`rand client` = T2.client_id INNER JOIN district AS T3 ON T2.district_id = T3.district_id INNER JOIN state AS T4 ON T3.state_abbrev = T4.StateCode WHERE T1.priority = 0 GROUP BY T2.state ORDER BY COUNT(T2.state) DESC LIMIT 1
na
304
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
17
challenging
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client", "district", "state" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.priority", "client.client_id", "client.district_id", "client.state", "district.district_id", "district.state_abbrev", "state.statecode" ]
[ "callcenterlogs.\"rand client\"", "client.client_id", "client.district_id", "district.district_id", "district.state_abbrev", "state.statecode" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many complaints made by women and served after 3 pm received a timely response from the company?
women refers to sex = 'Female'; served after 3 pm refers to ser_time BETWEEN '15:00:01' AND '23:59:59'; received a timely response refers to "Timely response?" = 'Yes';
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'
na
305
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "BETWEEN", "FROM" ]
14
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client", "events" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.\"rand client\"", "callcenterlogs.ser_start", "client.client_id", "client.sex", "events.\"complaint id\"", "events.\"timely response?\"" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.\"rand client\"", "client.client_id", "events.\"complaint id\"" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many complaints were served in 5 minutes or less by DORIT and responded to the customer with an explanation, were made by phone?
served in 5 minutes or less refers to ser_time < '00:05:00'; DORIT refers to server = 'DORIT'; responded with an explanation refers to "Company response to consumer" = 'Closed with explanation'; made by refers to "Submitted via";
SELECT COUNT(T1.`Complaint ID`) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T1.ser_time < '00:05:00' AND T1.server = 'DORIT' AND T2.`Submitted via` = 'Phone' AND T2.`Company response to consumer` = 'Closed with explanation'
na
306
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
10
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "events" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.ser_time", "callcenterlogs.server", "events.\"company response to consumer\"", "events.\"complaint id\"", "events.\"submitted via\"" ]
[ "callcenterlogs.\"complaint id\"", "events.\"complaint id\"" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many clients with the last name Alvarado are from Maryland?
The abbreviation of Maryland is 'MD';
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'
na
307
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
11
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district", "state" ]
[ "client.client_id", "client.district_id", "client.last", "client.state", "district.district_id", "district.state_abbrev", "state.statecode" ]
[ "client.district_id", "district.district_id", "district.state_abbrev", "state.statecode" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many reviews by people between 30 and 50 years include the word 'great'?
between 30 and 50 years refers to age BETWEEN 30 AND 50; include the word great refers to Review like '%Great%';
SELECT COUNT(T1.Reviews) FROM reviews AS T1 INNER JOIN client AS T2 ON T1.district_id = T2.district_id WHERE T2.age BETWEEN 30 AND 50 AND T1.Reviews LIKE '%great%'
na
308
[ "AS", "AND", "SELECT", "LIKE", "INNER JOIN", "ON", "COUNT", "BETWEEN", "FROM" ]
11
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "reviews" ]
[ "client.age", "client.district_id", "reviews.district_id", "reviews.reviews" ]
[ "client.district_id", "reviews.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the full address of the customers who, having received a timely response from the company, have dispute about that response?
full address = address_1, address_2; received a timely response refers to Timely response? = 'Yes'; have dispute refers to "Consumer disputed?" = 'Yes';
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'
na
309
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.address_1", "client.address_2", "client.client_id", "events.\"consumer disputed?\"", "events.\"timely response?\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many complaints from female clients born in the year 2000 were not sent through the web?
female refers to sex = 'Female'; sent through refers to "Submitted via"; not sent through web refers to "Submitted via" ! = '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'
na
310
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
9
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.sex", "client.year", "events.\"submitted via\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
List all the complaints narratives made by the customer named Brenda and last name Mayer.
complaints narratives refers to "Consumer complaint narrative";
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'
na
311
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.first", "client.last", "events.\"consumer complaint narrative\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many complaints from customers with a gmail.com email were received by the company in February 2017?
gmail.com email refers to email like '%gmail.com'; in February 2017 refers to "Date received" BETWEEN '2017-01-02' AND '2017-02-28';
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'
na
312
[ "OR", "AND", "SELECT", "AS", "LIKE", "-", "INNER JOIN", "ON", "COUNT", "FROM" ]
14
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"date received\"", "callcenterlogs.\"rand client\"", "client.client_id", "client.email" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the average number of stars given by Oregon clients in their reviews?
average = DIVIDE(SUM(State = 'Oregon'), COUNT(district_id)); Oregon refers to state = 'Oregon';
SELECT CAST(SUM(T3.Stars) AS REAL) / COUNT(T3.Stars) AS average FROM state AS T1 INNER JOIN district AS T2 ON T1.StateCode = T2.state_abbrev INNER JOIN reviews AS T3 ON T2.district_id = T3.district_id WHERE T1.State = 'Oregon'
na
313
[ "AS", "SELECT", "SUM", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
14
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "district", "reviews", "state" ]
[ "district.district_id", "district.state_abbrev", "reviews.district_id", "reviews.stars", "state.state", "state.statecode" ]
[ "district.district_id", "district.state_abbrev", "reviews.district_id", "state.statecode" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What percentage of clients who sent their complaints by postal mail are age 50 and older?
percentage = MULTIPLY(DIVIDE(SUM("Submitted via" = 'Postal mail'), COUNT(client_id)), 1.0); sent their complaints by refers to "Submitted via"; age > 50;
SELECT CAST(SUM(CASE WHEN T1.age > 50 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.`Submitted via`) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Submitted via` = 'Postal mail'
na
314
[ "CASE WHEN", "AS", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
12
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.age", "client.client_id", "events.\"submitted via\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the average age of Norwalk clients?
average age = AVG(age); Norwalk refers to city = 'Norwalk';
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'
na
315
[ "AS", "SELECT", "SUM", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
11
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district" ]
[ "client.age", "client.district_id", "district.city", "district.district_id" ]
[ "client.district_id", "district.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many clients who live in Kansas City provided a 1-star review?
1-star review refers stars = 1;
SELECT COUNT(T1.Stars) FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.city = 'Kansas City' AND T1.Stars = 1
na
316
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
8
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "district", "reviews" ]
[ "district.city", "district.district_id", "reviews.district_id", "reviews.stars" ]
[ "district.district_id", "reviews.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Which state has the highest number of clients who gave a 5-star review?
highest number of clients refers to MAX(COUNT(client_id)); 5-star review refers to stars = 5;
SELECT T2.state_abbrev FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.Stars = 5 GROUP BY T2.state_abbrev ORDER BY COUNT(T2.state_abbrev) DESC LIMIT 1
na
317
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
11
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "district", "reviews" ]
[ "district.district_id", "district.state_abbrev", "reviews.district_id", "reviews.stars" ]
[ "district.district_id", "reviews.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
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'
na
318
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district" ]
[ "client.district_id", "client.first", "client.last", "district.district_id", "district.division" ]
[ "client.district_id", "district.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How did Kyran Muller submit his complaint?
how it was submitted refers to "Submitted via";
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'
na
319
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.first", "client.last", "events.\"submitted via\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What are the products that people who were born after 2005 complain about?
year > 2005;
SELECT DISTINCT T2.Product FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.year > 2005
na
320
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.year", "events.client_id", "events.product" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How long was Kendall Allen's complaint about her credit card?
how long refers to ser_time; credit card refers to Product = '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'
na
321
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
12
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client", "events" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.ser_time", "client.client_id", "client.first", "client.last", "client.sex", "events.\"complaint id\"", "events.client_id", "events.product" ]
[ "callcenterlogs.\"complaint id\"", "client.client_id", "events.\"complaint id\"", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What was the issue that the client with the longest server time faced?
longest server time refers to MAX(ser_time);
SELECT T2.Issue FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T1.ser_time = ( SELECT MAX(ser_time) FROM callcenterlogs )
na
322
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM", "MAX" ]
9
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "events" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.ser_time", "events.\"complaint id\"", "events.issue" ]
[ "callcenterlogs.\"complaint id\"", "events.\"complaint id\"" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many clients who live in New York City submitted their complaints via fax?
submitted complaints via fax refers to "Submitted via" = 'Fax';
SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.city = 'New York City' AND T2.`Submitted via` = 'Fax'
na
323
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
8
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.city", "client.client_id", "events.\"submitted via\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the percentage of male clients complaining about their credit cards?
percentage = MULTIPLY(DIVIDE(SUM(sex = 'Male'), COUNT(client_id)), 1.0); male refers to sex = 'Male'; credit cards refers to Product = 'Credit card';
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'
na
324
[ "CASE WHEN", "AS", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
12
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.sex", "events.client_id", "events.product" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Please list any two clients with their full names who have been tagged as "Older American" by the company without seeking their permission.
full names = first, middle, last; without seeking their permission refers to "Consumer consent provided?" in (null, 'N/A' or 'empty');
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
na
325
[ "AS", "AND", "SELECT", "/", "LIMIT", "NULL", "IN", "INNER JOIN", "ON", "FROM" ]
11
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.first", "client.last", "client.middle", "events.\"consumer consent provided?\"", "events.client_id", "events.tags" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the birth date of the youngest client?
birth date refers to year, month, day; youngest client refers to max(year, month, day)
SELECT day, month, year FROM client ORDER BY year DESC, month DESC, day DESC LIMIT 1
na
326
[ "SELECT", "ORDER BY", "LIMIT", "FROM", "DESC" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client" ]
[ "client.day", "client.month", "client.year" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many times does the consumer have no dispute over a non-timely response from the company?
no dispute refers to Consumer disputed? = 'No'; non-timely response refers to Timely response? = 'No'
SELECT COUNT(`Timely response?`) FROM events WHERE `Timely response?` = 'No' AND `Consumer disputed?` = 'No'
na
327
[ "COUNT", "AND", "SELECT", "FROM" ]
4
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "events" ]
[ "events.\"consumer disputed?\"", "events.\"timely response?\"" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many of the complaints are longer than 15 minutes?
longer than 15 minutes refers to ser_time > '00:15:00'
SELECT COUNT(ser_time) FROM callcenterlogs WHERE strftime('%M', ser_time) > '15'
na
328
[ "strftime", "COUNT", "SELECT", "FROM" ]
4
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs" ]
[ "callcenterlogs.ser_time" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the most common issue for the highest priority complaints?
most common refers to max(count(issue)); highest priority refers to priority = 2
SELECT T1.Issue FROM events AS T1 INNER JOIN callcenterlogs AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.priority = 2 GROUP BY T1.Issue ORDER BY COUNT(T1.Issue) DESC LIMIT 1
na
329
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
11
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "events" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.priority", "events.\"complaint id\"", "events.issue" ]
[ "callcenterlogs.\"complaint id\"", "events.\"complaint id\"" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
List the full names of all clients who live in the Pacific division.
full name refers to first, last
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'
na
330
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district" ]
[ "client.district_id", "client.first", "client.last", "client.middle", "district.district_id", "district.division" ]
[ "client.district_id", "district.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the social number of the person who made the most complaints?
social number refers to social; most complaints refers to max(count(event.Client_ID))
SELECT T1.social FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID GROUP BY T1.client_id ORDER BY COUNT(T1.client_id) DESC LIMIT 1
na
331
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
11
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.social", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Which is the city where most of the 1 star reviews come from?
most refers to max(count(state_abbrev)); 1 star review refers to Stars = 1
SELECT T2.city FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.Stars = 1 GROUP BY T2.city ORDER BY COUNT(T2.city) DESC LIMIT 1
na
332
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
11
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "district", "reviews" ]
[ "district.city", "district.district_id", "reviews.district_id", "reviews.stars" ]
[ "district.district_id", "reviews.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the address of the client who made a complaint via postal mail on March 14, 2012?
address refers to address_1, address_2; via postal mail refers to Submitted via = 'Postal mail'; March 14 2012 refers to Date received = '2012-03-14'
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'
na
333
[ "AS", "AND", "SELECT", "-", "INNER JOIN", "ON", "FROM" ]
9
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.address_1", "client.address_2", "client.client_id", "events.\"date received\"", "events.\"submitted via\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Among the female clients, how many of them have a complaint with a priority of 1?
female refers to sex = 'Female'
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
na
334
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
8
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.priority", "client.client_id", "client.sex" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
List all the server of the phone complaints with a late response from the company.
phone complaint refers to Submitted via = 'Phone'; late response refers to Timely response? = 'No'
SELECT DISTINCT T2.server FROM events AS T1 INNER JOIN callcenterlogs AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T1.`Submitted via` = 'Phone' AND T1.`Timely response?` = 'No'
na
335
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "events" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.server", "events.\"complaint id\"", "events.\"submitted via\"", "events.\"timely response?\"" ]
[ "callcenterlogs.\"complaint id\"", "events.\"complaint id\"" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
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'
na
336
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
8
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.first", "client.last", "client.middle", "events.client_id", "events.issue" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the name of the state that the client with the email "[email protected]" 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 = '[email protected]'
na
337
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
9
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district", "state" ]
[ "client.district_id", "client.email", "client.state", "district.district_id", "district.state_abbrev", "state.statecode" ]
[ "client.district_id", "district.district_id", "district.state_abbrev", "state.statecode" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Which region has the second most clients?
region refers to division; second most refers to second max(client_id)
SELECT T2.division FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id GROUP BY T2.division ORDER BY COUNT(T2.division) DESC LIMIT 1, 1
na
338
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
11
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district" ]
[ "client.district_id", "district.district_id", "district.division" ]
[ "client.district_id", "district.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Who is the owner of the final phone number for the complaints on server "MORIAH" on 9/11/2013?
owner refers to first, middle, last; on 9/11/2013 refers to Date received = '2013-09-11'
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'
na
339
[ "AS", "AND", "SELECT", "-", "INNER JOIN", "ON", "FROM" ]
9
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"date received\"", "callcenterlogs.\"rand client\"", "callcenterlogs.server", "client.client_id", "client.first", "client.last", "client.middle" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Compute the average time in minute for each age group
teenager refers to 13 < age < = 19; adult refers to 19 < age < = 65; elder refers to age < = 65; highest average time per complaint = max(divide(sum(ser_time), count(ser_time)))
SELECT CAST(SUM(CASE WHEN T1.age > 13 AND T1.age <= 19 THEN 60 * strftime('%H', ser_time) + strftime('%M', ser_time) + strftime('%S', ser_time) / 60 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.age > 13 AND T1.age <= 19 THEN 1 ELSE 0 END) AS teenagerAverageMins, CAST(SUM(CASE WHEN T1.age > 19 AND T1.age <= 65 THEN 60 * 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`
na
340
[ "CASE WHEN", "AS", "AND", "SELECT", "SUM", "strftime", "CASE", "INNER JOIN", "ON", "CAST", "FROM" ]
46
challenging
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.ser_time", "client.age", "client.client_id" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What percentage of complaints are from the elderly?
elder refers to age < = 65; percentage refers to divide(sum(age < = 65) , count(client_id)) * 100%
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
na
341
[ "CASE WHEN", "AS", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
12
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.age", "client.client_id", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Calculate the percentage of male clients from Indianapolis City.
male refers to sex = 'Male'; Indianapolis City refers to city = 'Indianapolis'; percentage = divide(count(client_id where sex = 'Male' and city = 'Indianapolis') , count(client_id where city = 'Indianapolis')) * 100%
SELECT CAST(SUM(CASE WHEN sex = 'Male' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(client_id) FROM client WHERE city = 'Indianapolis'
na
342
[ "CASE WHEN", "AS", "SELECT", "SUM", "CASE", "CAST", "COUNT", "FROM" ]
8
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client" ]
[ "client.city", "client.client_id", "client.sex" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Among the teenager clients who use Google account and Microsoft account, which group of client is more than the other?
teenager refers to 13 < age < = 19; Google account refers to email like '%@gmail.com'; Microsoft account refers to email like '%@outlook.com'
SELECT CASE WHEN SUM(CASE WHEN email LIKE '%@gmail.com' THEN 1 ELSE 0 END) > SUM(CASE WHEN email LIKE '%@outlook.com' THEN 1 ELSE 0 END) THEN 'Google account' ELSE 'Microsoft account' END FROM client WHERE age BETWEEN 13 AND 19
na
343
[ "CASE WHEN", "AND", "SELECT", "SUM", "LIKE", "CASE", "BETWEEN", "FROM" ]
14
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client" ]
[ "client.age", "client.email" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the full name of client whose email address is [email protected]?
full name refers to first middle last
SELECT first, middle, last FROM client WHERE email = '[email protected]'
na
344
[ "SELECT", "FROM" ]
2
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client" ]
[ "client.email", "client.first", "client.last", "client.middle" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the first name of clients who have the highest priority?
first name refers to first; highest priority refers to priority = 2
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 )
na
345
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM", "MAX" ]
9
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.priority", "client.client_id", "client.first" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
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'
na
346
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.type", "client.client_id", "client.email" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Among the elderlies, state the last name of whose complaint is handled in server YIFAT?
elder refers to age < = 65; last name refers to last
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'
na
347
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.server", "client.age", "client.client_id", "client.last" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many clients who live in New York City have the complaint outcome as "AGENT"?
New York City refers to city = 'New York City'
SELECT COUNT(T2.`rand client`) FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T1.city = 'New York City' AND T2.outcome = 'AGENT'
na
348
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
8
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.outcome", "client.city", "client.client_id" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
List down the full name of clients who have disputed the response from company.
full name refers to first, middle, last; disputed the response refers to Consumer disputed? = 'Yes'
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'
na
349
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.first", "client.last", "client.middle", "events.\"consumer disputed?\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What are the complaint id of client who were born in 1931?
in 1931 refers to year = 1931
SELECT T2.`Complaint ID` FROM client AS T1 INNER JOIN callcenterlogs AS T2 ON T1.client_id = T2.`rand client` WHERE T1.year = 1931
na
350
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.\"rand client\"", "client.client_id", "client.year" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Calculate the percentage of complaints made by Google account client in server ZOHARI.
Google account refers to email like '%@gmail.com'; percentage = divide(count(Complaint ID where email like '%@gmail.com') , count(Complaint ID)) * 100%
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'
na
351
[ "CASE WHEN", "AS", "SELECT", "SUM", "LIKE", "CASE", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
13
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.server", "client.client_id", "client.email" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
State the full name of clients with server time of 20 minutes and above.
full name refers to first, middle, last; server time of 20 minutes and above refers to ser_time > '00:20:00'
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'
na
352
[ "AS", "SELECT", "strftime", "INNER JOIN", "ON", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.ser_time", "client.client_id", "client.first", "client.last", "client.middle" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Pick 5 clients with 0 priority and write down their last name.
0 priority refers to priority = 0; last name refers to last
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
na
353
[ "AS", "SELECT", "LIMIT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.priority", "client.client_id", "client.last" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Write down the call id of clients whose first name start with alphabet "B".
first name start with alphabet "B" refers to first like '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%'
na
354
[ "AS", "SELECT", "LIKE", "INNER JOIN", "ON", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.call_id", "client.client_id", "client.first" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
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'
na
355
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
8
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.first", "client.last", "client.middle", "events.client_id", "events.product" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
State the first name of male clients who did not receive timely response from the call center.
first name refers to first; male refers to sex = 'Male'; did not receive timely response refers to Timely response? = 'No'
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'
na
356
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.first", "client.sex", "events.\"timely response?\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Which product received the most complaints from elder clients?
most complaints refers to max(client_id); elder client refers to age > 65
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
na
357
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
9
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.age", "client.client_id", "events.client_id", "events.product" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Complaint about Credit Card mostly came from clients of which age group?
about Credit Card refers to Product = 'Credit Card'; teenager refers to 13 < age < = 19; adult refers to 19 < age < = 65; elder refers to age < = 65
SELECT SUM(CASE WHEN T1.age > 13 AND T1.age <= 19 THEN 1 ELSE 0 END), SUM(CASE WHEN T1.age > 19 AND T1.age <= 65 THEN 1 ELSE 0 END) AS adult , SUM(CASE WHEN T1.age > 65 THEN 1 ELSE 0 END) AS elder FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.Product = 'Credit card'
na
358
[ "CASE WHEN", "AS", "AND", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "FROM" ]
19
challenging
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.age", "client.client_id", "events.client_id", "events.product" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
List down the issues for complaint with server time of below 10 minutes.
server time of below 10 minutes refers to ser_time < '00:10:00'
SELECT T2.Issue FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE strftime('%M', T1.ser_time) < '10'
na
359
[ "AS", "SELECT", "strftime", "INNER JOIN", "ON", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "events" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.ser_time", "events.\"complaint id\"", "events.issue" ]
[ "callcenterlogs.\"complaint id\"", "events.\"complaint id\"" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Write down the date received of complaints sent via Fax.
sent via Fax refers to Submitted via = 'Fax'
SELECT T1.`Date received` FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.`Submitted via` = 'Fax'
na
360
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "events" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.\"date received\"", "events.\"complaint id\"", "events.\"submitted via\"" ]
[ "callcenterlogs.\"complaint id\"", "events.\"complaint id\"" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the full name of clients who have issue about balance transfer?
full name refers to first, middle, last; issue about balance transfer refers to Issue = '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'
na
361
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.first", "client.last", "client.middle", "events.client_id", "events.issue" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the email address of clients who submitted their complaints via postal mail?
via postal mail refers to Submitted 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'
na
362
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.email", "events.\"submitted via\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Calculate the average age of clients whose response is "Closed with relief".
average age = avg(age where Company response to consumer = 'Closed with relief'); response "Closed with relief" refers to Company response to consumer = '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'
na
363
[ "AS", "SELECT", "INNER JOIN", "ON", "AVG", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.age", "client.client_id", "events.\"company response to consumer\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the average age of clients whose complaint type is "TT"?
average age = avg(age where type = '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'
na
364
[ "AS", "SELECT", "INNER JOIN", "ON", "AVG", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client" ]
[ "callcenterlogs.\"rand client\"", "callcenterlogs.type", "client.age", "client.client_id" ]
[ "callcenterlogs.\"rand client\"", "client.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Write the complaint ID, call ID, and final phone number of complaints through AVIDAN server from 1/1/2014 to 12/30/2014.
final phone number refers to phonefinal; from 1/1/2014 to 12/30/2014 refers to Date received between '2014-01-01' and '2014-12-30'
SELECT `Complaint ID`, call_id, phonefinal FROM callcenterlogs WHERE strftime('%Y', `Date received`) = '2014' AND server = 'AVIDAN'
na
365
[ "strftime", "AND", "SELECT", "FROM" ]
4
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.\"date received\"", "callcenterlogs.call_id", "callcenterlogs.phonefinal", "callcenterlogs.server" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Between 1/1/2017 and 4/1/2017, what is the average server time of calls under the server DARMON?
between 1/1/2017 and 4/1/2017 refers to Date received between '2017-01-01' and '2017-04-01'; average server time refers to avg(ser_time)
SELECT AVG(CAST(SUBSTR(ser_time, 4, 2) AS REAL)) FROM callcenterlogs WHERE `Date received` BETWEEN '2017-01-01' AND '2017-04-01'
na
366
[ "AS", "AND", "SELECT", "-", "AVG", "SUBSTR", "CAST", "BETWEEN", "FROM" ]
12
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs" ]
[ "callcenterlogs.\"date received\"", "callcenterlogs.ser_time" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many times per year does a credit card customer complain about overlimit fees?
credit card customer refers to product = 'Credit card'; about overlimit fees refers to issue = 'Overlimit fee'
SELECT strftime('%Y', `Date received`), COUNT(`Date received`) FROM events WHERE product = 'Credit card' AND issue = 'Overlimit fee' GROUP BY strftime('%Y', `Date received`) HAVING COUNT(`Date received`)
na
367
[ "GROUP BY", "AND", "SELECT", "HAVING", "strftime", "COUNT", "FROM" ]
9
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "events" ]
[ "events.\"date received\"", "events.issue", "events.product" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Among the clients in Middle Atlantic, how many are them are female and no more than 18 years old?
in Middle Atlantic refers to division = 'Middle Atlantic'; female refers to sex = 'Female'; no more than 18 refers to age < 18
SELECT COUNT(T1.sex) FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.division = 'Middle Atlantic' AND T1.sex = 'Female' AND T1.age < 18
na
368
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
9
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district" ]
[ "client.age", "client.district_id", "client.sex", "district.district_id", "district.division" ]
[ "client.district_id", "district.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Give me the full birthdate, email and phone number of the youngest client in Indianapolis .
full birthdate = year, month, day; youngest refers to max(year, month, day); in Indianapolis refers to city = 'Indianapolis'
SELECT T1.year, T1.month, T1.day, T1.email, T1.phone FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.city = 'Indianapolis' ORDER BY T1.year DESC, T1.month DESC, T1.day DESC LIMIT 1
na
369
[ "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
11
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district" ]
[ "client.day", "client.district_id", "client.email", "client.month", "client.phone", "client.year", "district.city", "district.district_id" ]
[ "client.district_id", "district.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
List the top five cities in terms of the number of 5-star ratings in 2016 reviews, in descending order.
5-star rating refers to Stars = 5; in 2016 refers to Date like '2016%'; most reviews refers to max(count(city))
SELECT T2.city FROM reviews AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T1.Stars = 5 AND T1.Date LIKE '2016%' ORDER BY T1.Date DESC LIMIT 5
na
370
[ "AS", "AND", "SELECT", "LIKE", "LIMIT", "ORDER BY", "INNER JOIN", "ON", "DESC", "FROM" ]
11
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "district", "reviews" ]
[ "district.city", "district.district_id", "reviews.date", "reviews.district_id", "reviews.stars" ]
[ "district.district_id", "reviews.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the longest server time when the call is about the issue of arbitration?
longest server time refers to max(ser_time)
SELECT MAX(T1.ser_time) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.issue = 'Arbitration'
na
371
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM", "MAX" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "events" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.ser_time", "events.\"complaint id\"", "events.issue" ]
[ "callcenterlogs.\"complaint id\"", "events.\"complaint id\"" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Give me the social number and state of the client whose phone number is 100-121-8371.
social number refers to social
SELECT T1.social, T1.state 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 T1.phone = '100-121-8371'
na
372
[ "AS", "SELECT", "-", "INNER JOIN", "ON", "FROM" ]
11
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district", "state" ]
[ "client.district_id", "client.phone", "client.social", "client.state", "district.district_id", "district.state_abbrev", "state.statecode" ]
[ "client.district_id", "district.district_id", "district.state_abbrev", "state.statecode" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
List the full names and phone numbers of clients that were from the Pacific.
full name refers to first, middle, last; the Pacific refers to division = 'Pacific'
SELECT T1.first, T1.middle, T1.last, T1.phone FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.division = 'Pacific'
na
373
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district" ]
[ "client.district_id", "client.first", "client.last", "client.middle", "client.phone", "district.district_id", "district.division" ]
[ "client.district_id", "district.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the social number of the client who has the longest delay in his/her complaint? Calculate the days of delay and state the company's response to the consumer.
social number refers to social; longest delay = max(subtract(Date sent to company, Date received)); days of delay = subtract(Date sent to company, Date received); company's response refers to 'Company response to consumer'
SELECT T1.social , 365 * (strftime('%Y', T2.`Date sent to company`) - strftime('%Y', T2.`Date received`)) + 30 * (strftime('%M', T2.`Date sent to company`) - strftime('%M', T2.`Date received`)) + (strftime('%d', T2.`Date sent to company`) - strftime('%d', T2.`Date received`)), T2.`Company response to consumer` FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID ORDER BY 365 * (strftime('%Y', T2.`Date sent to company`) - strftime('%Y', T2.`Date received`)) + 30 * (strftime('%M', T2.`Date sent to company`) - strftime('%M', T2.`Date received`)) + (strftime('%d', T2.`Date sent to company`) - strftime('%d', T2.`Date received`)) DESC LIMIT 1
na
374
[ "AS", "SELECT", "strftime", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "FROM" ]
21
challenging
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.social", "events.\"company response to consumer\"", "events.\"date received\"", "events.\"date sent to company\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many female clients are there older than 30?
female refers to sex = 'Female'; older than 30 refers to age > 30
SELECT COUNT(sex) FROM client WHERE sex = 'Female' AND age > 30
na
375
[ "COUNT", "AND", "SELECT", "FROM" ]
4
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client" ]
[ "client.age", "client.sex" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Please list all first and last names of clients who live in New York city.
New York City refers to city = 'New York City'
SELECT first, last FROM client WHERE city = 'New York City'
na
376
[ "SELECT", "FROM" ]
2
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client" ]
[ "client.city", "client.first", "client.last" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the oldest age of male clients?
oldest age refers to max(age); male refers to sex = 'Male'
SELECT MAX(age) FROM client WHERE sex = 'Male'
na
377
[ "SELECT", "FROM", "MAX" ]
3
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client" ]
[ "client.age", "client.sex" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Please calculate the number of clients by each division.
SELECT T2.division, COUNT(T2.division) FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id GROUP BY T2.division
na
378
[ "GROUP BY", "AS", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
8
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district" ]
[ "client.district_id", "district.district_id", "district.division" ]
[ "client.district_id", "district.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the percentage of female clients in the Middle Atlantic?
female refers to sex = 'Female'; the Middle Atlantic refers to division = 'Middle Atlantic'; percentage = divide(count(client_id where sex = 'Female' and division = 'Middle Atlantic') , count(client_id where division = 'Middle Atlantic')) * 100%
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 district AS T2 ON T1.district_id = T2.district_id WHERE T2.division = 'South Atlantic'
na
379
[ "CASE WHEN", "AS", "SELECT", "SUM", "CASE", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
12
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district" ]
[ "client.district_id", "client.sex", "district.district_id", "district.division" ]
[ "client.district_id", "district.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the average age of clients in South Atlantic?
in South Atlantic refers to division = 'South Atlantic'; average age refers to avg(age)
SELECT AVG(T1.age) FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.division = 'South Atlantic'
na
380
[ "AS", "SELECT", "INNER JOIN", "ON", "AVG", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district" ]
[ "client.age", "client.district_id", "district.district_id", "district.division" ]
[ "client.district_id", "district.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Which city in the Midwest region has the least number of clients?
least number of clients refers to min(count(client_id))
SELECT T2.city FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id INNER JOIN state AS T3 ON T2.state_abbrev = T3.StateCode WHERE T3.Region = 'Midwest' GROUP BY T2.city ORDER BY COUNT(T2.city) LIMIT 1
na
381
[ "GROUP BY", "AS", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "COUNT", "FROM" ]
13
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district", "state" ]
[ "client.district_id", "district.city", "district.district_id", "district.state_abbrev", "state.region", "state.statecode" ]
[ "client.district_id", "district.district_id", "district.state_abbrev", "state.statecode" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
How many customers in the Northeast use Microsoft email?
the Northeast refers to Region = 'Northeast'; Microsoft email refers to email like '%@outlook.com'
SELECT COUNT(T1.email) 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' AND T1.email LIKE '%@outlook.com'
na
382
[ "AS", "AND", "SELECT", "LIKE", "INNER JOIN", "ON", "COUNT", "FROM" ]
12
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district", "state" ]
[ "client.district_id", "client.email", "district.district_id", "district.state_abbrev", "state.region", "state.statecode" ]
[ "client.district_id", "district.district_id", "district.state_abbrev", "state.statecode" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Which city in West North Central has the highest number of customers over the age of 60?
in North Central refers to Region = 'North Central'; highest number of customers refers to max(count(client_id)); over the age of 60 refers to age > 60
SELECT T2.city FROM client AS T1 INNER JOIN district AS T2 ON T1.district_id = T2.district_id WHERE T2.division = 'West North Central' AND T1.age > 60 GROUP BY T2.city ORDER BY COUNT(T2.city) DESC LIMIT 1
na
383
[ "GROUP BY", "AS", "AND", "SELECT", "ORDER BY", "LIMIT", "INNER JOIN", "ON", "DESC", "COUNT", "FROM" ]
12
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "district" ]
[ "client.age", "client.district_id", "district.city", "district.district_id", "district.division" ]
[ "client.district_id", "district.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
What is the percentage of complaints about the late fee issue whose priority is 2 in 2017?
percentage = divide(count(Complaint ID where priority = 2) , count(Complaint ID)) * 100%; in 2017 refers to year(Date received) = 2017
SELECT CAST(SUM(CASE WHEN T1.priority = 2 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.`Complaint ID`) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE strftime('%Y', T1.`Date received`) = '2017'
na
384
[ "CASE WHEN", "AS", "SELECT", "SUM", "strftime", "CASE", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
13
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "events" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.\"date received\"", "callcenterlogs.priority", "events.\"complaint id\"" ]
[ "callcenterlogs.\"complaint id\"", "events.\"complaint id\"" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Which state has the most cities?
state refers to state_abbrev; most cities refers to max(count(city))
SELECT state_abbrev FROM district GROUP BY state_abbrev ORDER BY COUNT(city) DESC LIMIT 1
na
385
[ "GROUP BY", "SELECT", "ORDER BY", "LIMIT", "COUNT", "FROM", "DESC" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "district" ]
[ "district.city", "district.state_abbrev" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Please give the first name and phone number of the client whose complaint id is CR0922485.
first name refers to first
SELECT T1.first, T1.phone FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Complaint ID` = 'CR0922485'
na
386
[ "AS", "SELECT", "INNER JOIN", "ON", "FROM" ]
6
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.first", "client.phone", "events.\"complaint id\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Please list the emails of the clients whose complaint date received is 7/3/2014.
7/3/2014 refers to Date received = '2014-07-03'
SELECT T1.email FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Date received` = '2014-07-03'
na
387
[ "AS", "SELECT", "-", "INNER JOIN", "ON", "FROM" ]
8
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.email", "events.\"date received\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
In 2012, how many complaints about Credit card product came from clients in Omaha?
in 2012 refers to Date received LIKE'2012%'; in Omaha refers to city = 'Omaha'
SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.city = 'Omaha' AND strftime('%Y', T2.`Date received`) = '2012' AND T2.Product = 'Credit card'
na
388
[ "AS", "AND", "SELECT", "strftime", "INNER JOIN", "ON", "COUNT", "FROM" ]
10
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.city", "client.client_id", "events.\"date received\"", "events.client_id", "events.product" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
From 2012 to 2015, how many complaints were submitted via email from female clients?
from 2012 to 2015 refers to Date received BETWEEN 2012 AND 2015; submitted via email refers to Submitted via = 'Email'; female refers to sex = 'Female'
SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE strftime('%Y', T2.`Date received`) BETWEEN '2012' AND '2015' AND T2.`Submitted via` = 'Email' AND T1.sex = 'Male'
na
389
[ "AS", "AND", "SELECT", "strftime", "INNER JOIN", "ON", "COUNT", "BETWEEN", "FROM" ]
12
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.sex", "events.\"date received\"", "events.\"submitted via\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Please list all clients' phone numbers and complaint IDs which are still in progress.
in progress refers to Company response to consumer = 'In progress'
SELECT T1.phone, T2.`Complaint ID` FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.`Company response to consumer` = 'In progress'
na
390
[ "AS", "SELECT", "INNER JOIN", "ON", "In", "FROM" ]
7
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.client_id", "client.phone", "events.\"company response to consumer\"", "events.\"complaint id\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
In 2015, how many complaints about Billing disputes were sent by clients in Portland?
in 2015 refers to Date received LIKE'2015%'; about Billing disputes refers to Issue = 'Billing disputes'; Portland refers to city = 'Portland'
SELECT COUNT(T1.client_id) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.city = 'Portland' AND T2.`Date received` LIKE '2015%' AND T2.Issue = 'Billing disputes'
na
391
[ "AS", "AND", "SELECT", "LIKE", "INNER JOIN", "ON", "COUNT", "FROM" ]
10
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.city", "client.client_id", "events.\"date received\"", "events.client_id", "events.issue" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
In 2014, what is the percentage of complaints from consumers in Houston that the delay was over 5 days?
in 2014 refers to Date received LIKE'2014%'; Houston refers to city = 'Houston'; delay over 5 days refers to subtract(Date sent to company, Date received) > 5; percentage = divide(count(Complaint ID where subtract(Date sent to company , Date received) > 5) , count(Complaint ID)) * 100%
SELECT CAST((SUM(CASE WHEN strftime('%J', T2.`Date sent to company`) - strftime('%J', T2.`Date received`) > 5 THEN 1 ELSE 0 END)) AS REAL) * 100 / COUNT(T1.client_id) FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.city = 'Houston' AND strftime('%Y', T2.`Date received`) = '2014'
na
392
[ "CASE WHEN", "AS", "AND", "SELECT", "SUM", "strftime", "CASE", "INNER JOIN", "ON", "CAST", "COUNT", "FROM" ]
16
challenging
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "client", "events" ]
[ "client.city", "client.client_id", "events.\"date received\"", "events.\"date sent to company\"", "events.client_id" ]
[ "client.client_id", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
In the complains received in 2012, how many of them are submitted through email?
received in 2012 refers to Date received LIKE '2012%'; submitted through email refers to Submitted via = 'Email'
SELECT COUNT(`Submitted via`) FROM events WHERE strftime('%Y', `Date received`) = '2012' AND `Submitted via` = 'Email'
na
393
[ "AND", "SELECT", "strftime", "COUNT", "FROM" ]
5
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "events" ]
[ "events.\"date received\"", "events.\"submitted via\"" ]
[]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Give the client ID of the complaint received on April 16, 2014 and submitted through fax.
April 16, 2014 refers to Date received = '2014-04-16'; submitted through fax refers to Submitted via = 'Fax'
SELECT T2.Client_ID FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.`Submitted via` = 'Fax' AND T1.`Date received` = '2014-04-16'
na
394
[ "AS", "AND", "SELECT", "-", "INNER JOIN", "ON", "FROM" ]
9
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "events" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.\"date received\"", "events.\"complaint id\"", "events.\"submitted via\"", "events.client_id" ]
[ "callcenterlogs.\"complaint id\"", "events.\"complaint id\"" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
List date of the review of the Eagle Capital from Indianapolis, Indiana.
Eagle Capital refers to Product = 'Eagle Capital'; Indianapolis refers to city = 'Indianapolis'; Indiana refers to state_abbrev = 'IN'
SELECT T2.Date FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T2.Product = 'Eagle Capital' AND T1.city = 'Indianapolis' AND T1.state_abbrev = 'IN'
na
395
[ "AS", "AND", "SELECT", "INNER JOIN", "IN", "ON", "FROM" ]
9
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "district", "reviews" ]
[ "district.city", "district.district_id", "district.state_abbrev", "reviews.date", "reviews.district_id", "reviews.product" ]
[ "district.district_id", "reviews.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Among the complaints received in year 2015, what is total number of complaints timely response and closed with an explanation?
in year 2015 refers to Date received LIKE '2015%'; timely response refers to Timely response?" = 'Yes'; closed with an explanation refers to Company response to consumer = 'Closed with explanation'
SELECT COUNT(T1.`Complaint ID`) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE strftime('%Y', T1.`Date received`) = '2015' AND T2.`Timely response?` = 'Yes' AND T2.`Company response to consumer` = 'Closed with explanation'
na
396
[ "AS", "AND", "SELECT", "strftime", "INNER JOIN", "ON", "COUNT", "FROM" ]
10
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "events" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.\"date received\"", "events.\"company response to consumer\"", "events.\"complaint id\"", "events.\"timely response?\"" ]
[ "callcenterlogs.\"complaint id\"", "events.\"complaint id\"" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
Among the female clients that age between 20 to 40, list the date when their complaints were received.
female refers to sex = 'Female'
SELECT DISTINCT T3.`Date received` FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID INNER JOIN callcenterlogs AS T3 ON T2.`Complaint ID` = T3.`Complaint ID` WHERE T1.age BETWEEN 20 AND 40 AND T1.sex = 'Female'
na
397
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "BETWEEN", "FROM" ]
12
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "callcenterlogs", "client", "events" ]
[ "callcenterlogs.\"complaint id\"", "callcenterlogs.\"date received\"", "client.age", "client.client_id", "client.sex", "events.\"complaint id\"", "events.client_id" ]
[ "callcenterlogs.\"complaint id\"", "client.client_id", "events.\"complaint id\"", "events.client_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
List the product reviewed with 1 star on March 14, 2016 from Newton, Massachusetts.
1 star refers to Stars = 1; on March 14, 2016 refers to Date = '2016-03-14'; Newton refers to city = 'Newton'; Massachusetts refers to state_abbrev = 'MA'
SELECT T2.Product FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T1.city = 'Newton' AND T1.state_abbrev = 'MA' AND T2.Date = '2016-03-14' AND T2.Stars = 1
na
398
[ "AS", "AND", "SELECT", "-", "INNER JOIN", "ON", "FROM" ]
11
medium
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "district", "reviews" ]
[ "district.city", "district.district_id", "district.state_abbrev", "reviews.date", "reviews.district_id", "reviews.product", "reviews.stars" ]
[ "district.district_id", "reviews.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }
retail_complains
In reviews for the Eagle National Bank product, how many of the 5 star reviews where from Nashville, Tennessee?
5 star refers to Stars = 5; Nashville refers to city = 'Nashville'; Tennessee refers to state_abbrev = 'TN'
SELECT COUNT(T2.Stars) FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T1.city = 'Nashville' AND T1.state_abbrev = 'TN' AND T2.Product = 'Eagle National Mortgage' AND T2.Stars = 5
na
399
[ "AS", "AND", "SELECT", "INNER JOIN", "ON", "COUNT", "FROM" ]
10
simple
{"state": {"statecode": "TEXT", "state": "TEXT", "region": "TEXT"}, "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"}, "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"}, "district": {"district_id": "INTEGER", "city": "TEXT", "state_abbrev": "TEXT", "division": "TEXT"}, "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"}, "reviews": {"date": "DATE", "stars": "INTEGER", "reviews": "TEXT", "product": "TEXT", "district_id": "INTEGER"}}
[ "district", "reviews" ]
[ "district.city", "district.district_id", "district.state_abbrev", "reviews.district_id", "reviews.product", "reviews.stars" ]
[ "district.district_id", "reviews.district_id" ]
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE -- example: ['2017-03-23', '2017-03-27'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"rand client\" TEXT -- example: ['C00004587', 'C00003328'],\n\tphonefinal TEXT -- example: ['322-598-7152', '977-806-9726'],\n\t\"vru+line\" TEXT -- example: ['AA0103', 'AA0205'],\n\tcall_id INTEGER -- example: ['34536', '34537'],\n\tpriority INTEGER -- example: ['0', '2'],\n\ttype TEXT -- example: ['NW', 'PS'],\n\toutcome TEXT -- example: ['HANG', 'AGENT'],\n\tserver TEXT -- example: ['MICHAL', 'TOVA'],\n\tser_start TEXT -- example: ['13:34:11', '10:58:22'],\n\tser_exit TEXT -- example: ['11:16:10', '13:40:23'],\n\tser_time TEXT -- example: ['00:17:48', '00:06:12'],\n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT -- example: ['C00000002', 'C00000001'],\n\tsex TEXT -- example: ['Male', 'Female'],\n\tday INTEGER -- example: ['4', '13'],\n\tmonth INTEGER -- example: ['2', '12'],\n\tyear INTEGER -- example: ['1990', '1965'],\n\tage INTEGER -- example: ['54', '29'],\n\tsocial TEXT -- example: ['806-94-5725', '926-93-2157'],\n\tfirst TEXT -- example: ['Noah', 'Emma'],\n\tmiddle TEXT -- example: ['Avaya', 'Everest'],\n\tlast TEXT -- example: ['Thompson', 'Smith'],\n\tphone TEXT -- example: ['212-423-7734', '367-171-6840'],\n\temail TEXT -- example: ['[email protected]', '[email protected]'],\n\taddress_1 TEXT -- example: ['387 Wellington Ave.', '75 W. Berkshire St.'],\n\taddress_2 TEXT -- example: ['Unit 6', 'Unit 1'],\n\tcity TEXT -- example: ['New York City', 'Albuquerque'],\n\tstate TEXT -- example: ['NY', 'NM'],\n\tzipcode INTEGER -- example: ['47246', '10040'],\n\tdistrict_id INTEGER -- example: ['1', '18'],\n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER -- example: ['2', '1'],\n\tcity TEXT -- example: ['New York City', 'Jacksonville'],\n\tstate_abbrev TEXT -- example: ['NY', 'FL'],\n\tdivision TEXT -- example: ['South Atlantic', 'Middle Atlantic'],\n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE -- example: ['2014-07-03', '2012-04-12'],\n\t\"Product\" TEXT -- example: ['Credit card', 'Bank account or service'],\n\t\"Sub-product\" TEXT -- example: ['Savings account', 'Checking account'],\n\t\"Issue\" TEXT -- example: ['Account opening, closing, or management', 'Deposits and withdrawals'],\n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT -- example: [\"I called Eagle National Bank 's customer service l\", 'Deposited a XXXX check into my account, BOFA is te'],\n\t\"Tags\" TEXT -- example: ['Older American, Servicemember', 'Older American'],\n\t\"Consumer consent provided?\" TEXT -- example: ['N/A', 'Consent not provided'],\n\t\"Submitted via\" TEXT -- example: ['Fax', 'Email'],\n\t\"Date sent to company\" TEXT -- example: ['2012-04-13', '2014-07-09'],\n\t\"Company response to consumer\" TEXT -- example: ['Closed with relief', 'Closed with explanation'],\n\t\"Timely response?\" TEXT -- example: ['No', 'Yes'],\n\t\"Consumer disputed?\" TEXT -- example: ['No', 'Yes'],\n\t\"Complaint ID\" TEXT -- example: ['CR0000072', 'CR0000084'],\n\t\"Client_ID\" TEXT -- example: ['C00001366', 'C00003714'],\n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE -- example: ['2013-02-04', '2013-02-06'],\n\t\"Stars\" INTEGER -- example: ['5', '1'],\n\t\"Reviews\" TEXT -- example: ['Great job, Eagle National! Each person was profess', 'Matthew Richardson is professional and helpful. He'],\n\t\"Product\" TEXT -- example: ['Eagle National Mortgage', 'Eagle National Bank'],\n\tdistrict_id INTEGER -- example: ['65', '66'],\n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT -- example: ['AL', 'AR'],\n\t\"State\" TEXT -- example: ['Arkansas', 'Alabama'],\n\t\"Region\" TEXT -- example: ['West', 'South'],\n\tPRIMARY KEY (\"StateCode\")\n)" }
{ "schema": "\nCREATE TABLE callcenterlogs (\n\t\"Date received\" DATE, \n\t\"Complaint ID\" TEXT, \n\t\"rand client\" TEXT, \n\tphonefinal TEXT, \n\t\"vru+line\" TEXT, \n\tcall_id INTEGER, \n\tpriority INTEGER, \n\ttype TEXT, \n\toutcome TEXT, \n\tserver TEXT, \n\tser_start TEXT, \n\tser_exit TEXT, \n\tser_time TEXT, \n\tPRIMARY KEY (\"Complaint ID\"), \n\tCONSTRAINT fk_callcenterlogs_client FOREIGN KEY(\"rand client\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE client (\n\tclient_id TEXT, \n\tsex TEXT, \n\tday INTEGER, \n\tmonth INTEGER, \n\tyear INTEGER, \n\tage INTEGER, \n\tsocial TEXT, \n\tfirst TEXT, \n\tmiddle TEXT, \n\tlast TEXT, \n\tphone TEXT, \n\temail TEXT, \n\taddress_1 TEXT, \n\taddress_2 TEXT, \n\tcity TEXT, \n\tstate TEXT, \n\tzipcode INTEGER, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (client_id), \n\tCONSTRAINT fk_client_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE district (\n\tdistrict_id INTEGER, \n\tcity TEXT, \n\tstate_abbrev TEXT, \n\tdivision TEXT, \n\tPRIMARY KEY (district_id), \n\tCONSTRAINT fk_district_state FOREIGN KEY(state_abbrev) REFERENCES state (\"StateCode\")\n)\n\n\nCREATE TABLE events (\n\t\"Date received\" DATE, \n\t\"Product\" TEXT, \n\t\"Sub-product\" TEXT, \n\t\"Issue\" TEXT, \n\t\"Sub-issue\" TEXT, \n\t\"Consumer complaint narrative\" TEXT, \n\t\"Tags\" TEXT, \n\t\"Consumer consent provided?\" TEXT, \n\t\"Submitted via\" TEXT, \n\t\"Date sent to company\" TEXT, \n\t\"Company response to consumer\" TEXT, \n\t\"Timely response?\" TEXT, \n\t\"Consumer disputed?\" TEXT, \n\t\"Complaint ID\" TEXT, \n\t\"Client_ID\" TEXT, \n\tPRIMARY KEY (\"Complaint ID\", \"Client_ID\"), \n\tCONSTRAINT fk_events_callcenterlogs FOREIGN KEY(\"Complaint ID\") REFERENCES callcenterlogs (\"Complaint ID\"),\n\tCONSTRAINT fk_events_client FOREIGN KEY(\"Client_ID\") REFERENCES client (client_id)\n)\n\n\nCREATE TABLE reviews (\n\t\"Date\" DATE, \n\t\"Stars\" INTEGER, \n\t\"Reviews\" TEXT, \n\t\"Product\" TEXT, \n\tdistrict_id INTEGER, \n\tPRIMARY KEY (\"Date\"), \n\tCONSTRAINT fk_reviews_district FOREIGN KEY(district_id) REFERENCES district (district_id)\n)\n\n\nCREATE TABLE state (\n\t\"StateCode\" TEXT, \n\t\"State\" TEXT, \n\t\"Region\" TEXT, \n\tPRIMARY KEY (\"StateCode\")\n)" }