db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
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
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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 cli...
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
disney
Which director has made the most movies?
the most movies refers to MAX(COUNT(name));
SELECT director, COUNT(name) FROM director GROUP BY director ORDER BY COUNT(name) DESC LIMIT 1
CREATE TABLE movies_total_gross ( MPAA_rating TEXT, -- Example Values: `G`, ``, `Not Rated`, `PG`, `R` | Value Statics: Total count 579 - Distinct count 6 - Null count 0 release_date TEXT, -- total_gross TEXT, -- foreign key (movie_title) references characters(movie_title), movie_title TEXT, -- genre TEX...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
retail_complains
Please calculate the number of clients by each division.
null
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
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
retail_complains
What are the issues of the complains of male clients and products from age 25 and below?
male refers to sex = 'Male'; age 25 and below refers to age < 25
SELECT DISTINCT T2.Issue FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.sex = 'Male' AND T1.age < 25
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
retail_complains
List the products involved in the complaints received on March 2017 via TOVA server.
on March 2017 refers to Date received LIKE '%03%' AND Date received LIKE '2017%'
SELECT DISTINCT T2.Product FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T1.server = 'TOVA' AND T2.`Date received` LIKE '2017-03%'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
retail_complains
Among the reviews from midwest region, what are the products that received 1 star?
1 star refers to Stars = 1
SELECT DISTINCT T3.Product FROM state AS T1 INNER JOIN district AS T2 ON T1.StateCode = T2.state_abbrev INNER JOIN reviews AS T3 ON T2.district_id = T3.district_id WHERE T1.Region = 'Midwest' AND T3.Stars = 1
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
retail_complains
In complaints about the credit card product, list the phone number of the oldest client.
oldest refers to max(age)
SELECT T1.phone FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.Product = 'Credit card' ORDER BY T1.age DESC LIMIT 1
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
retail_complains
In reviews of product with 5 stars, what is the percentage of the reviews coming from the division of East North Central?
5 stars refers to Stars = 5; percentage = divide(count(division = 'East North Central', count(division)) * 100%
SELECT CAST(SUM(CASE WHEN T1.division = 'East North Central' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.division) FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T2.Stars = 5
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
retail_complains
What is the division of the review of 5 stars received on December 17, 2017 for the product Eagle National Mortgage?
5 stars refers to Stars = 5; on December 17 2017 refers to Date = '2017-12-17'
SELECT T1.division FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T2.Stars = 5 AND T2.Date = '2017-12-17' AND T2.Product = 'Eagle National Mortgage'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
retail_complains
List the product and its issues of the complains of clients with age greater than the 60% of average age of all clients.
age greater than the 60% of average age refers to age > multiply(avg(age) , 0.6)
SELECT DISTINCT T2.Product, T2.Issue FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.age * 100 > ( SELECT AVG(age) * 60 FROM client )
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
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
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
movies_4
How many production companies does the movie "Four Rooms" have?
movie "Four Rooms" refers to title = 'Four Rooms'
SELECT COUNT(CNAME) FROM ( SELECT T1.company_name AS CNAME FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T3.title = 'Four Rooms' )
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
retail_complains
In complaints received in 2014, how many of them were submitted via call?
in 2014 refers to Date received LIKE '2014%'; submitted via call refers to Submitted via = 'Phone'
SELECT COUNT(T2.`Complaint ID`) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.`Submitted via` = 'Phone' AND strftime('%Y', T1.`Date received`) = '2014'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
movies_4
What is the title of the latest released movie produced by production company "Universal Pictures"?
"Universal Pictures" refers to company_name = 'Universal Pictures'; latest released refers to max(release_date)
SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Universal Pictures' ORDER BY T3.release_date DESC LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
Please list the names of the production company of the movie "Four Rooms".
names of the production company refers to movie_company; movie "Four Rooms" refers to title = 'Four Rooms'
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T3.title = 'Four Rooms'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
What was the job of Dariusz Wolski in the movie "Pirates of the Caribbean: At World's End"?
movie "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: At World''s End'
SELECT T2.job FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T3.person_name = 'Dariusz Wolski'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
Please list the titles of all the movie produced by production company "Universal Pictures".
"Universal Pictures" refers to company_name = 'Universal Pictures'
SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Universal Pictures'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
How many crew members worked as producer in the movie "Pirates of the Caribbean: At World's End"?
worked as producer refers to job = 'Producer'; "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: At World''s End'
SELECT COUNT(T3.person_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Producer'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
What is the name of the director of photography of the movie "Pirates of the Caribbean: At World's End"?
name of the director of photography refers to person_name where job = 'Director of Photography'; "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: At World''s End'
SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Director of Photography'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
In how many movie does Dariusz Wolski work as the director of photography?
director of photography refers to job = 'Director of Photography'
SELECT COUNT(T2.movie_id) FROM person AS T1 INNER JOIN movie_crew AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
Please list the names of all the crew members of the movie "Pirates of the Caribbean: At World's End".
names refers to person_name; "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: At World''s End'
SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
Please list the names of all the producers in the movie "Pirates of the Caribbean: At World's End".
names refers to person_name; producers refers to job = 'Producer'; "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: At World''s End'
SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Producer'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
When was the release date of the latest movie in which Dariusz Wolski worked as a crew member?
release date of the latest movie refers to max(release_date)
SELECT T1.release_date FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' ORDER BY T1.release_date DESC LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
movies_4
Give the name of the movie with a revenue of 559852396.
name of the movie refers to title; revenue of 559852396 refers to revenue = '559852396'
SELECT title FROM movie WHERE revenue = 559852396
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
Among the movie in which Dariusz Wolski works as the director of photography, what is the title of the one with the highest average vote?
director of photography refers to job = 'Director of Photography'; highest average vote refers to max(vote_average)
SELECT T1.title FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography' ORDER BY T1.vote_average DESC LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
What is the average revenue of the movie in which Dariusz Wolski works as the director of photography?
director of photography refers to job = 'Director of Photography'; average revenue = divide(sum(revenue), count(movie_id))
SELECT CAST(SUM(T1.revenue) AS REAL) / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
How many movies were directed by Michael Bay?
directed by refers to job = 'Director'
SELECT COUNT(T2.movie_id) FROM person AS T1 INNER JOIN movie_crew AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Michael Bay' AND T2.job = 'Director'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
Among the movie in which Dariusz Wolski works as the director of photography, what is the percentage of those movie whose vote average is over 5.0?
director of photography refers to job = 'Director of Photography'; vote average is over 8.0 refers to vote_average > 5; percentage = divide(sum(movie_id) when vote_average > 5, count(movie_id)) as percentage
SELECT CAST(COUNT(CASE WHEN T1.vote_average > 5 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.vote_average) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
What was David Rubin's job in the movie "Days of Thunder"?
"Days of Thunder" refers to title = 'Days of Thunder'
SELECT T2.job FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'David Rubin' AND T1.title = 'Days of Thunder'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
For the movie "Land of the Dead", who is its director?
"Land of the Dead" refers to title = 'Land of the Dead'; director refers to person_name where job = 'Director'
SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Land of the Dead' AND T2.job = 'Director'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
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%'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
beer_factory
What is the difference in the average number of sales per day of root beer brands that contain honey and that don’t contain honey.
difference in the average = SUBTRACT(DIVIDE(MULTIPLY(SUM(Honey = 'TRUE'), 1.0), COUNT(TransactionDate)), DIVIDE(MULTIPLY(SUM(Honey = 'FALSE'), 1.0), COUNT(TransactionDate))); contain honey refers to Honey = 'TRUE'; don’t contain honey refers to Honey = 'FALSE'
SELECT (CAST(SUM(CASE WHEN T1.Honey = 'TRUE' THEN 1 ELSE 0 END) AS REAL) / COUNT(DISTINCT T3.TransactionDate)) - (CAST(SUM(CASE WHEN T1.Honey <> 'TRUE' THEN 1 ELSE 0 END) AS REAL) / COUNT(DISTINCT T3.TransactionDate)) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction`...
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
Provide the most used keyword in the movies.
most used keyword refers to keyword_name where max(count(keyword_name))
SELECT T1.keyword_name FROM keyword AS T1 INNER JOIN movie_keywords AS T2 ON T1.keyword_id = T2.keyword_id GROUP BY T1.keyword_name ORDER BY COUNT(T1.keyword_name) DESC LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
What is the precise location of all paying customers with American Express?
precise location refers to Latitude, Longitude; American Express refers to CreditCardType = 'American Express';
SELECT DISTINCT T2.Latitude, T2.Longitude FROM `transaction` AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.CreditCardType = 'American Express'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
Show the total number of keywords of the movie "I Hope They Serve Beer in Hell".
"I Hope They Serve Beer in Hell" refers to title = 'I Hope They Serve Beer in Hell';
SELECT COUNT(T2.keyword_id) FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'I Hope They Serve Beer in Hell'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
How many female characters are there in the movie "Spider-Man 3"?
female characters refer to gender = 'Female'; "Spider-Man 3" refers to title = 'Spider-Man 3'
SELECT COUNT(*) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Spider-Man 3' AND T3.gender = 'Female'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
In the reviews of September 2014. Which brand of beers obtained the highest star ratings?
September 2014 refers to ReviewDate LIKE '2014-09%'; brand of beers refers to BrandName; highest star ratings refers to MAX(StarRating);
SELECT DISTINCT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 AND T2.ReviewDate BETWEEN '2014-09-01' AND '2014-09-30'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
What is the production company of the movie "Crazy Heart"?
movie "Crazy Heart" refers to title = 'Crazy Heart'; production company refers to company_name
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T3.title = 'Crazy Heart'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
Tell the number of movies made by Paramount Animation.
Paramount Animation refers to company_name = 'Paramount Animation'
SELECT COUNT(T2.movie_id) FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id WHERE T1.company_name = 'Paramount Animation'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
From which cities are the customers who gave 5 stars in their reviews in November 2012?
5 stars refers to StarRating = 5; in November 2012 refers to ReviewDate LIKE '2012-11%';
SELECT DISTINCT T1.City FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 5 AND T2.ReviewDate BETWEEN '2012-11-01' AND '2012-11-30'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
How many producers does the movie "The Amityville Horror" have?
producers refers to job = 'Producer'; "The Amityville Horror" refers to title = 'The Amityville Horror'
SELECT COUNT(T2.person_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'The Amityville Horror' AND T2.job = 'Producer'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
Find and list the full name and email of the customers who used American Express cards in Sac State Union.
full name = First, Last; American Express cards refers to CreditCardType = 'American Express'; Sac State Union refers to LocationName = 'Sac State Union';
SELECT DISTINCT T1.First, T1.Last, T1.Email FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN location AS T3 ON T2.LocationID = T3.LocationID WHERE T3.LocationName = 'Sac State Union' AND T2.CreditCardType = 'American Express'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
For all the movies which were produced by Cruel and Unusual Films, which one has the most popularity?
produced by Cruel and Unusual Films refers to company_name = 'Cruel and Unusual Films'; most popularity refers to max(popularity)
SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Cruel and Unusual Films' ORDER BY T3.popularity DESC LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
beer_factory
What credit card is the most used in the purchase of non-alcoholic beer?
credit card that is the most used refers to MAX(COUNT(CreditCardType)); non-alcoholic beer refers to Alcoholic = 'FALSE';
SELECT T2.CreditCardType FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T3.Alcoholic = 'FALSE' GROUP BY T2.CreditCardType ORDER BY COUNT(T2.CreditCardType) DESC LIMIT 1
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
Calculate the average budget of the movies directed by Jaume Collet-Serra.
directed by refers to job = 'Director'; average budget = AVG(budget)
SELECT CAST(SUM(T1.budget) AS REAL) / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Jaume Collet-Serra' AND T2.job = 'Director'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
How many Folsom customers prefer to pay with Visa?
Folsom refers to City = 'Folsom'; Visa refers to CreditCardType = 'Visa';
SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.City = 'Folsom' AND T2.CreditCardType = 'Visa'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
Give the number of movies with "saving the world" as the keyword.
"saving the world" as the keyword refers to keyword_name = 'saving the world'
SELECT COUNT(T2.movie_id) FROM keyword AS T1 INNER JOIN movie_keywords AS T2 ON T1.keyword_id = T2.keyword_id WHERE keyword_name = 'saving the world'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
What brand of beer has been the worst rated most times?
brand of beer refers to BrandName; worst rated most times refers to MAX(COUNT(StarRating = 1));
SELECT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T2.BrandID = T1.BrandID WHERE T2.StarRating = 1 GROUP BY T1.BrandName ORDER BY COUNT(T1.BrandName) DESC LIMIT 1
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
For the movie "Reign of Fire", which department was Marcia Ross in?
movie "Reign of Fire" refers to title = 'Reign of Fire'; which department refers to department_name
SELECT T4.department_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id INNER JOIN department AS T4 ON T2.department_id = T4.department_id WHERE T3.person_name = 'Marcia Ross' AND T1.title = 'Reign of Fire'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
What is the title of the movie that was made with the most money and resources?
made with the most money and resources refers to max(budget)
SELECT title FROM movie ORDER BY budget DESC LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
What is the full name of the customer who gave a 5-star rating and commented "The quintessential dessert root beer. No ice cream required" on his review?
full name = First, Last; 5-star rating refers to StarRating = 5; commented "The quintessential dessert root beer. No ice cream required" refers to Review = 'The quintessential dessert root beer. No ice cream required.';
SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 5 AND T2.Review = 'The quintessential dessert root beer. No ice cream required.'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
beer_factory
What brands of beer has Peg Winchester consumed?
brands of beer refers to BrandName;
SELECT T3.BrandName FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T2.BrandID = T3.BrandID WHERE T1.First = 'Peg' AND T1.Last = 'Winchester'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
When was the first movie released?
when the first movie refers to release_date where min(release_date)
SELECT MIN(release_date) FROM movie WHERE movie_status = 'Released'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
What is the precise location of zip code 95819?
precise location = Latitude, Longitude;
SELECT T2.Latitude, T2.Longitude FROM location AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.ZipCode = 95819
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
What is the percentage of male characters in the movie "Bride Wars"?
male refers to gender = 'Male'; "Bride Wars" refers to title = 'Bride Wars'; percentage = divide(sum(gender = 'Male'), count(gender)) * 100 as percentage
SELECT CAST(COUNT(CASE WHEN T3.gender = 'Male' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T3.gender) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Bride Wars'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
How many movies have made at least 1 Billion at the box office?
have made at least 1 Billion at the box office refers to revenue > 1000000000
SELECT COUNT(movie_id) FROM movie WHERE revenue > 1000000000
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
What is the name of all the customers who have ever given a 5-star review?
name of the customer = First, Last; 5-star review refers to StarRating = 5;
SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 5
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
retail_complains
What is the product complained by Alexander Bronx Lewis?
null
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'
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
movies_4
Provide the title of the movie that is most-liked by a large number of people.
most-liked by a large number of people refers to max(popularity)
SELECT title FROM movie ORDER BY popularity DESC LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
What star rating is the most common for beers containing corn syrup?
most common refers to MAX(COUNT(StarRating)); containing corn syrup refers to CornSyrup = 'TRUE';
SELECT T2.StarRating FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.CornSyrup = 'TRUE' GROUP BY T2.StarRating ORDER BY COUNT(T2.StarRating) DESC LIMIT 1
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
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
CREATE TABLE state ( Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 State TEXT, -- StateCode TEXT constraint state_pk primary key, ); CREATE TABLE callcenterlogs ( ser_time TEXT, -- "Complaint ID" TEXT, -- ser_exi...
movies_4
What is the name of the production company that made the most movies?
name of the production company refers to company_name; most movies refers to max(count(company_name))
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id ORDER BY COUNT(T2.movie_id) DESC LIMIT 1
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
How many crew are named John Young?
null
SELECT COUNT(person_id) FROM person WHERE person_name = 'John Young'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
movies_4
How many movies did Universal Studios release?
Universal Studios refers to company_name = 'Universal Studios'
SELECT COUNT(T2.movie_id) FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id WHERE T1.company_name = 'Universal Studios'
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
What is the average unit profit for wholesalers of canned beers?
average unit profit = DIVIDE(SUM(SUBTRACT(CurrentRetailPrice, WholesaleCost)), COUNT(ContainerType = 'Can')); canned beers refers to ContainerType = 'Can';
SELECT AVG(T2.CurrentRetailPrice - T2.WholesaleCost) FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T1.ContainerType = 'Can'
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...
movies_4
Who is the person associated with the crew id 1325273?
Who is the person refers to person_name; crew id 1325273 refers to person_id = 1325273
SELECT person_name FROM person WHERE person_id = 1325273
CREATE TABLE production_company ( company_name TEXT default NULL, -- company_id INTEGER not null primary key, ); CREATE TABLE gender ( gender TEXT default NULL, -- Example Values: `Unspecified`, `Female`, `Male` | Value Statics: Total count 3 - Distinct count 3 - Null count 0 gender_id INTEGER not null primar...
beer_factory
At what latitude is the Thomas Kemper brand beer consumed the most?
Thomas Kemper refers to BrandName = 'Thomas Kemper';  latitude the beer is consumed the most refers to MAX(COUNT(Latitude));
SELECT T3.Latitude FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID INNER JOIN geolocation AS T3 ON T1.LocationID = T3.LocationID WHERE T2.BrandName = 'Thomas Kemper' GROUP BY T3.Latitude ORDER BY COUNT(T1.BrandID) DESC LIMIT 1
CREATE TABLE rootbeerbrand ( Website TEXT, -- State TEXT, -- Example Values: `CA`, `MA`, `LA`, `WA`, `QLD` | Value Statics: Total count 23 - Distinct count 14 - Null count 1 Twitter TEXT, -- Example Values: `https://twitter.com/ilovedads`, `https://twitter.com/1919rootbeer` | Value Statics: Total count 2 - Dist...