db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
european_football_1
Which team won the match in the EC division on January 20, 2008 at home?
won at home refers to FTR = 'H'; January 20, 2008 refers to Date = '2008-01-20'; EC division refers to Div = 'EC';
SELECT HomeTeam FROM matchs WHERE Div = 'EC' AND Date = '2008-01-20' AND FTR = 'H'
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
trains
Which direction does the majority of the trains that have 3 cars are running?
3 cars refers to carsNum = 3
SELECT T1.direction FROM trains AS T1 INNER JOIN ( SELECT train_id, COUNT(id) AS carsNum FROM cars GROUP BY train_id HAVING carsNum = 3 ) AS T2 ON T1.id = T2.train_id GROUP BY T1.direction
CREATE TABLE cars ( `id` INTEGER NOT NULL, -- `load_shape` TEXT DEFAULT NULL, -- Example Values: `circle`, `hexagon`, `triangle`, `rectangle`, `diamond` | Value Statics: Total count 63 - Distinct count 5 - Null count 0 `train_id` INTEGER DEFAULT NULL, -- `load_num` INTEGER DEFAULT NULL, -- Example Values: `1...
movie_3
To which country does the address '1386 Nakhon Sawan Boulevard' belong?
null
SELECT T1.country FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id WHERE T3.address = '1386 Nakhon Sawan Boulevard'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
mental_health_survey
From 2016 to 2019, how many users each year were asked the question 13?
From 2016 to 2019 refer to SurveyID 2016 BETWEEN 2019; Question 13 refer to QuestionID
SELECT SurveyID, COUNT(UserID) FROM Answer WHERE QuestionID = 13 AND SurveyID BETWEEN 2016 AND 2019 GROUP BY SurveyID
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
european_football_1
How many matches were played in the Scottish Premiership division from 2006 to 2008?
Scottish Premiership is a name of division; from 2006 to 2008 means seasons between 2006 and 2008;
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Scottish Premiership' AND (T1.season BETWEEN 2006 AND 2008)
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
trains
Among the trains running west, how many trains have no more than one car with an open roof?
running west refers to direction = 'west'; open roof refers to roof = 'none'
SELECT SUM(CASE WHEN T1.direction = 'west' THEN 1 ELSE 0 END)as count FROM trains AS T1 INNER JOIN ( SELECT train_id, COUNT(id) FROM cars WHERE roof = 'none' GROUP BY train_id HAVING COUNT(id) = 1 ) AS T2 ON T1.id = T2.train_id
CREATE TABLE cars ( `id` INTEGER NOT NULL, -- `load_shape` TEXT DEFAULT NULL, -- Example Values: `circle`, `hexagon`, `triangle`, `rectangle`, `diamond` | Value Statics: Total count 63 - Distinct count 5 - Null count 0 `train_id` INTEGER DEFAULT NULL, -- `load_num` INTEGER DEFAULT NULL, -- Example Values: `1...
movie_3
How many payments were made throughout the month of August 2005?
payments made refers to amount; throughout the month of August 2005 refers to payment_date like '2005-08%'
SELECT SUM(amount) FROM payment WHERE payment_date LIKE '2005-08%'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
public_review_platform
Tell the number of "hair removal" Yelp businesses.
hair removal refers to category_name = 'Hair Removal';
SELECT COUNT(T1.category_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id WHERE T1.category_name LIKE 'Hair Removal'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
movie_3
How many movies have a length longer than 100?
length longer than 100 refers to length > 100
SELECT COUNT(film_id) FROM film WHERE length > 100
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
european_football_1
Please provide the names of any three away teams that competed in the Italian divisions.
Italian means belong to country = 'Italy";
SELECT T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.country = 'Italy' LIMIT 3
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
movie_3
How many actors with the surname Kilmer are there?
surname means last_name;
SELECT COUNT(actor_id) FROM actor WHERE last_name = 'Kilmer'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
student_loan
How many female students have enlisted for the Army?
female students refers to enlist.name who are NOT in male.name; Army refers to organ = 'army';
SELECT SUM(IIF(T3.name IS NULL, 1, 0)) AS "result" FROM enlist AS T1 INNER JOIN person AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T2.name = T3.name WHERE T1.organ = 'army'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
public_review_platform
Provide the businesses name in Tempe city whose opening hours are earlier than 8AM.
opening hours refers to opening_time; earlier than 8AM refers to opening_time < '8AM';
SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T3.city LIKE 'Tempe' AND T4.opening_time < '8AM'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
european_football_1
Of all the teams that played as a team away against Caen in the 2010 season, which one has the highest winning percentage?
Caen refers to HomeTeam; which one refers to AwayTeam; the highest winning percentage = MAX(DIVIDE(COUNT(FTR = 'A' where HomeTeam = 'Caen', season = '2010')), COUNT(Div where HomeTeam = 'Caen', season = '2010')) as percentage;
SELECT AwayTeam FROM matchs WHERE HomeTeam = 'Caen' AND season = 2010 AND FTR = 'A' GROUP BY AwayTeam ORDER BY COUNT(AwayTeam) DESC LIMIT 1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
movie
When is the birthday of the actor who played "Sully"?
birthday refers to Date of Birth; "Sully" refers to Character Name = 'Sully'
SELECT T2.`Date of Birth` FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T1.`Character Name` = 'Sully'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
movie_3
Indicate the title of all the films rated as 'Adults Only'.
'Adults Only' refers to rating = 'NC-17'
SELECT title FROM film WHERE rating = 'NC-17'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
mental_health_survey
Betweeen 2016 to 2019, which year recorded the highest number of people with mental illness?
Between 2016 to 2019 refer to SurveyID 2016 BETWEEN 2019; People with mental illness refers to AnswerText = 'Yes' where questionid = 34
SELECT T1.SurveyID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID BETWEEN 2016 AND 2019 AND T2.questionid = 34 AND T1.AnswerText LIKE 'Yes' GROUP BY T1.SurveyID ORDER BY COUNT(T1.UserID) DESC LIMIT 1
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
public_review_platform
For the only Yelp business in "Yuma" city, how many "medium" reviews did it get?
medium reviews refers to review_length = 'Medium';
SELECT COUNT(T2.review_length) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Yuma' AND T2.review_length LIKE 'Medium'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
european_football_1
How many times did Valencia's home team win in the LaLiga division?
LaLiga is a name of the division; Valencia's home team refers to HomeTeam = 'Valencia'; win refers to FTR = 'H';
SELECT COUNT(T1.HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga' AND T1.HomeTeam = 'Valencia' AND T1.FTR = 'H'
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
trains
What are the ids of the train running east?
east is a direction
SELECT id FROM trains WHERE direction = 'east'
CREATE TABLE cars ( `id` INTEGER NOT NULL, -- `load_shape` TEXT DEFAULT NULL, -- Example Values: `circle`, `hexagon`, `triangle`, `rectangle`, `diamond` | Value Statics: Total count 63 - Distinct count 5 - Null count 0 `train_id` INTEGER DEFAULT NULL, -- `load_num` INTEGER DEFAULT NULL, -- Example Values: `1...
movie_3
Find and list the full name of customers who rented more family movies than Sci-Fi movies.
full name refers to first_name, last_name; 'family' AND 'Sci-Fi' are names of the category; customers who rented more family movies than Sci-Fi movies refers to count(name = 'Family') > count(name = 'Sci-Fi')
SELECT DISTINCT IIF(SUM(IIF(T5.name = 'Family', 1, 0)) - SUM(IIF(T5.name = 'Sci-Fi', 1, 0)) > 0, T1.first_name, 0) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film_category AS T4 ON T4.film_id = T3.film_id INNE...
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
mental_health_survey
How many users answered "No" to question 19?
Question 19 refer to QuestionID = 19; No refer to AnswerText = 'No'
SELECT COUNT(QuestionID) FROM Answer WHERE QuestionID = 19 AND AnswerText LIKE 'No'
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
european_football_1
Which away team in the division of Bundesliga has the highest final time goals?
Bundesliga is a name of division; the highest final time goals refers to MAX(FTAG);
SELECT T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.name = 'Bundesliga' ORDER BY T1.FTAG DESC LIMIT 1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
movie
Show the birth city of the actor who played "Gabriel Martin".
"Gabriel Martin" refers to Character Name = 'Gabriel Martin'
SELECT T2.`Birth City` FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T1.`Character Name` = 'Gabriel Martin'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
movie_3
Calculate the percentage of customers who paid more than the average rent amount in store 1.
store 1 refers to store_id = 1; average rent amount refers to AVG(amount); calculation = DIVIDE(amount > AVG(amount), COUNT(customer_id)) * 100
SELECT CAST(( SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T2.amount > ( SELECT AVG(amount) FROM payment ) ) AS REAL) * 100 / ( SELECT COUNT(customer_id) FROM customer )
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
mental_health_survey
What are the ages of the oldest and youngest user that were surveyed? Indicate their user id.
Oldest user refer to MAX(AnswerText) where questionid = 1; Youngest user refer to MIN(AnswerText) where questionid = 1
SELECT MAX(T1.AnswerText), MIN(T1.AnswerText) , ( SELECT T1.UserID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 1 ORDER BY T1.AnswerText LIMIT 1 ) AS "youngest id" FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 1
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
public_review_platform
How many businesses are there in Phoenix city? Find the percentage of businesses in Phoenix city in the total city.
percentage = MULTIPLY(DIVIDE(SUM(city = 'Phoenix' END), COUNT(category_id)), 1.0);
SELECT SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS "num" , CAST(SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.city) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_i...
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
european_football_1
What is the name of the division that has had the lowest number of draft matches in the 2019 season?
the lowest number of draft matches refers to MIN(COUNT(FTR = 'D'));
SELECT T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2019 AND T1.FTR = 'D' GROUP BY T2.division ORDER BY COUNT(FTR) LIMIT 1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
movie
Who played the character named "Chanice Kobolowski"?
null
SELECT T2.Name FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T1.`Character Name` = 'Chanice Kobolowski'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
movie_3
In children's movies, which was rented the most?
children is the name of the category; rented the most refers to MAX(COUNT(title))
SELECT T.title FROM ( SELECT T4.title, COUNT(T4.title) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id INNER JOIN film_category AS T5 ON T4.film_id = T5.film_id INNER JO...
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
public_review_platform
How many compliments received from medium users that Phoenix city achieved?
medium refers to number_of_compliments = 'Medium';
SELECT COUNT(T1.number_of_compliments) FROM Users_Compliments AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.city LIKE 'Phoenix' AND T1.number_of_compliments LIKE 'Medium'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
european_football_1
How many football divisions does England have?
England is the name of country;
SELECT COUNT(division) FROM divisions WHERE country = 'England'
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
movie
How many movies has the highest networth actor acted in?
highest networth refers to max(networth)
SELECT COUNT(*) FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE CAST(REPLACE(REPLACE(T2.NetWorth, ',', ''), '$', '') AS REAL) = ( SELECT MAX(CAST(REPLACE(REPLACE(NetWorth, ',', ''), '$', '') AS REAL)) FROM actor)
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
movie_3
What is the average number of actors acted in comedy movies?
comedy is the name of a category; average number of actors refers to AVG(actor_id)
SELECT AVG(T1.actor_id) FROM film_actor AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id INNER JOIN actor AS T4 ON T4.actor_id = T1.actor_id WHERE T3.name = 'comedy'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
mental_health_survey
In 2019, how many users in the United States have a family history of mental illness?
2019 refer to SurveyID; Users in the United States refers to AnswerText = 'United States' where questionid = 3; have a family history of mental illness refers to AnswerText = 'Yes' where questionid = 6
SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN ( SELECT T2.questionid FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID = 2019 AND T2.questionid = 6 AND T1.AnswerText LIKE 'Yes' ) AS T2 ON T1.QuestionID = T2.questionid WHERE T1.SurveyID = 2019 AND T2.questionid = 3 AND...
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
movie
Who was the actor that played in the movie "Batman" with the longest screentime?
movie "Batman" refers to Title = 'Batman'; longest screentime refers to max(screentime)
SELECT T2.Name FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID INNER JOIN movie AS T3 ON T3.MovieID = T1.MovieID WHERE T3.Title = 'Batman' ORDER BY T1.screentime DESC LIMIT 1
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
movie_3
Find and list the full name of customers who rented more than five types of movies.
full name refers to first_name, last_name; types of movies means category of movies; rented more than five types of movies refers to COUNT(film_category) > 5
SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id INNER JOIN film_categor...
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
mental_health_survey
How many users believed that their productivity is ever affected by a mental health issue overall?
Users who believed that their productivity is affected by a mental health issues overall refers to AnswerText = 'Yes' where questionid = 54
SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 54 AND T1.AnswerText LIKE 'Yes'
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
public_review_platform
How many active businesses are there in Phoenix?
active businesses refers to active = 'true'; Phoenix refers to city = 'Phoenix';
SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Phoenix' AND active LIKE 'TRUE'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
movie
Which movie had the biggest budget? Give the name of the movie.
biggest budget refers to max(Budget); name of the movie refers to Title
SELECT Title FROM movie ORDER BY Budget DESC LIMIT 1
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
movie_3
Give the total amount of rent for the movie Clockwork Paradice.
'Clockwork Paradice' is a title of a film
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN rental AS T2 ON T1.rental_id = T2.rental_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T4.title = 'CLOCKWORK PARADICE'
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
european_football_1
What was the final score for the game Bursaspor vs Denizlispor on 2009/4/26?
Bursaspor vs Denizlispor are names of teams where HomeTeam = 'Bursaspor' and AwayTeam = 'Denizlispor'; Date = '2009-04-26'; final score refers to FTHG, FTAG;
SELECT FTHG, FTAG FROM matchs WHERE Date = '2009-04-26' AND HomeTeam = 'Bursaspor' AND AwayTeam = 'Denizlispor'
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
movie
What is the MPAA rating for the movie with the character named "Peter Quill" in it?
MPAA rating = 'G' means General audiences; MPAA rating = 'PG' means Parental guidance suggested; MPAA rating = 'R'means Restricted; MPAA rating = 'X' means No one under 17 admitted
SELECT T1.`MPAA Rating` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T2.`Character Name` = 'Peter Quill'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
movie_3
Of the movies in which Reese Kilmer acted, what percentage are action movies?
'Reese Kilmer' is a full name of an actor; 'action' is the name of the category; calculation = DIVIDE(COUNT('action'), COUNT(category_id)) * 100
SELECT CAST(SUM(IIF(T4.name = 'Action', 1, 0)) AS REAL) * 100 / COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film_category AS T3 ON T2.film_id = T3.film_id INNER JOIN category AS T4 ON T3.category_id = T4.category_id WHERE T1.first_name = 'Reese' AND T1.last_na...
CREATE TABLE staff ( last_name TEXT not null, -- Example Values: `Hillyer`, `Stephens` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 email TEXT, -- Example Values: `Mike.Hillyer@sakilastaff.com`, `Jon.Stephens@sakilastaff.com` | Value Statics: Total count 2 - Distinct count 2 - Null count 0 ...
student_loan
What is the name of the student with the longest duration of absence?
longest duration of absence refers to MAX(month);
SELECT name FROM longest_absense_from_school WHERE month = ( SELECT MAX(month) FROM longest_absense_from_school )
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
public_review_platform
What is the average rating of inactive businesses?
rating refers to stars; inactive refers to active = 'False'; average rating of inactive businesses = DIVIDE(SUM(stars), COUNT(business_id));
SELECT CAST(SUM(stars) AS REAL) / COUNT(business_id) AS "average" FROM Business WHERE active LIKE 'FALSE'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
movie
What is the average rating of all the movies starring Tom Cruise?
starring Tom Cruise refers to name = 'Tom Cruise'; average rating = divide(sum(rating where name = 'Tom Cruise'), count(movieid where name = 'Tom Cruise'))
SELECT AVG(T1.Rating) FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T3.Name = 'Tom Cruise'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
mental_health_survey
What is the average age of the survey respondents in the United States?
Average age refer to AVG(AnswerText) where questionid = 1; respondents in the United States refers to AnswerText = 'United States' where questionid = 3
SELECT CAST(SUM(T1.AnswerText) AS REAL) / COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN ( SELECT T1.UserID FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 3 AND T1.AnswerText = 'United States' ) AS T2 ON T1.UserID = T2.UserID INNER JOIN Question AS T3 ON T1.QuestionID ...
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
european_football_1
In how many matches in the Seria A division did both teams have equal goals?
Seria A is a name of division; equal goals refers to FTR = 'D', where D stands for draft;
SELECT COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Seria A' AND T1.FTR = 'D'
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
movie
Give the name of the No.1 character in the credit list from the highest rating thriller movie.
No.1 character in the credit list refers to creditOrder = '1'; highest rating refers to max(rating); thriller movie refers to Genre = 'Thriller'
SELECT T2.`Character Name` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T2.creditOrder = '1' AND T1.Genre = 'Thriller' ORDER BY T1.Rating DESC LIMIT 1
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
mental_health_survey
How many female users were surveyed in the mental health survey for 2017 in the state of Nebraska?
AnswerText = 'Yes' where questiontext = 'Do you have a family history of mental illness?'; AnswerText = 'Female' where questionid = 2; AnswerText = 'Nebraska' where questionid = 4
SELECT COUNT(*) FROM ( SELECT T2.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID INNER JOIN Survey AS T3 ON T2.SurveyID = T3.SurveyID WHERE T3.Description = 'mental health survey for 2017' AND T1.questionid = 2 AND T2.AnswerText = 'Female' UNION SELECT T2.UserID FROM Question AS T1 I...
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
public_review_platform
How many businesses in Glendale city that are still running is opened from 8AM to 6PM?
still running refers to active = 'true'; opened from 8AM to 6PM refers to opening_time = '8AM' AND closing_time = '6PM';
SELECT COUNT(T1.category_name) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T3.city LIKE 'Glendale' AND T4.opening_time LIKE '8AM' AND T4...
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
european_football_1
Who is the winner of the game happened on 2009/10/10, between "East Fife" and "Dumbarton"?
2009/10/10 is a date; the winner refers to FTR = 'A'; East Fife and Dumbarton are name of teams where HomeTeam = 'East Fife'; AwayTeam = 'Dumbarton';
SELECT CASE WHEN FTR = 'H' THEN 'East Fife' ELSE 'Dumbarton' END WINNER FROM matchs WHERE Date = '2009-10-10' AND HomeTeam = 'East Fife' AND AwayTeam = 'Dumbarton'
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
movie
How much longer in percentage is the screen time of the most important character in Batman than the least important one?
most important character refers to max(screentime); least important character refers to min(screentime); movie Batman refers to title = 'Batman'; percentage = divide(subtract(max(screentime) , min(screentime)) , min(screentime)) * 100%
SELECT (MAX(CAST(SUBSTR(T2.screentime, 3, 2) AS REAL)) - MIN(CAST(SUBSTR(T2.screentime, 3, 2) AS REAL))) * 100 / MIN(CAST(SUBSTR(T2.screentime, 3, 2) AS REAL)) FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T1.Title = 'Batman'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
mental_health_survey
What is the oldest age of the users in 2014's survey?
what is your age? refer to QuestionText; 2014 refer to SurveyID; oldest age refers to MAX(AnswerText)
SELECT T2.AnswerText FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'What is your age?' AND T2.SurveyID = 2014 ORDER BY T2.AnswerText DESC LIMIT 1
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
movie
How many movies star a male African American actor?
male refers to gender = 'Male'; African American refers to ethnicity = 'African American'
SELECT COUNT(*) FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T2.Gender = 'Male' AND T2.Ethnicity = 'African American'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
mental_health_survey
Which country have the least number of users being surveyed? Indicate the name of the country. If there are multiple countries having the same number of users, indicate all of their names.
Country with least number of users being surveyed refers to MIN(COUNT(AnswerText)) where questionid = 3
SELECT T1.AnswerText FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 3 GROUP BY T1.AnswerText ORDER BY COUNT(T1.UserID) DESC LIMIT 1
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
public_review_platform
How many cities have businesses with active life category? Find the percentage of the city where the review count that is low in total review count.
category refers to category_name; percentage = MULTIPLY(DIVIDE(SUM(category_name = 'Active Life'), SUM(review_count = 'LOW')), 1.0);
SELECT SUM(CASE WHEN T2.category_name LIKE 'Active Life' THEN 1 ELSE 0 END) AS "num" , CAST(SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS REAL) * 100 / ( SELECT COUNT(T3.review_count) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON ...
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
european_football_1
For the Ligue 2 game that made the most goals, who is the winner of that game?
Ligue 2 is the name of division; the most goals refer to MAX(SUM(FTHG, FTAG)) which are short names for Final-time Home-team Goals and Final-time Away-team Goals; winner refers to FTR = 'A';
SELECT CASE WHEN T1.FTR = 'H' THEN T1.HomeTeam ELSE T1.AwayTeam END WINNER FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Ligue 2' ORDER BY T1.FTAG + T1.FTHG DESC LIMIT 1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
movie
Among the actors who starred in the movie Batman, which one of them is the tallest?
movie Batman refers to title = 'Batman'; tallest refers to max(height_inches)
SELECT T3.Name FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T1.Title = 'Batman' ORDER BY T3.`Height (Inches)` DESC LIMIT 1
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
public_review_platform
Which city has the most businesses whose attribute is full_bar?
most business refers to MAX(business_id); full_bar refers to attribute_value = 'full_bar';
SELECT T1.city FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T2.attribute_value LIKE 'full_bar' GROUP BY T1.city
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
european_football_1
What's the name of the football division in the Netherlands?
Netherlands is the name of country;
SELECT name FROM divisions WHERE country = 'Netherlands'
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
movie
What is the name of the character played by Tom Cruise in the movie Born on the Fourth of July?
played by Tom Cruise refers to name = 'Tom Cruise'; movie Born on the Fourth of July refers to title = 'Born on the Fourth of July'
SELECT T2.`Character Name` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T3.Name = 'Tom Cruise' AND T1.Title = 'Born on the Fourth of July'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
mental_health_survey
How many questions in 2014's survey had more than 200 answers?
2014 refer to SurveyID; COUNT(QuestionID) where COUNT(AnswerText) > 200
SELECT COUNT(QuestionID) FROM Answer WHERE SurveyID LIKE 2014 GROUP BY QuestionID ORDER BY COUNT(QuestionID) > 200 LIMIT 1
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
european_football_1
When did the first match that score more than 10 goals happen?
score more than 10 goals refers to SUM(FTHG, FTAG)>10, which are short names for Final-time Home-team Goals and Final-time Away-team Goals; the first means the earliest and refers to MIN(Date);
SELECT MIN(Date) FROM matchs WHERE FTHG + FTAG > 10
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
movie
Please list the names of all the characters played by Tom Cruise.
played by Tom Cruise refers to name = 'Tom Cruise'
SELECT T1.`Character Name` FROM characters AS T1 INNER JOIN actor AS T2 ON T1.ActorID = T2.ActorID WHERE T2.Name = 'Tom Cruise'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
student_loan
What are the names of the students who joined the Marines?
Marines refers to organ = 'marines';
SELECT name FROM enlist WHERE organ = 'marines'
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
public_review_platform
How many businesses in Scottsdale are rated as "wonderful experience"?
Scottsdale refers to city = 'Scottsdale'; rated refers to stars; rated as wonderful experience refers to stars > 3;
SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Scottsdale' AND stars > 3
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
european_football_1
How many draw games happened on 2018/8/7 for National League?
National League is the name of division; Date = '2018-08-07'; draw refers to FTR = 'D'; games refer to Div;
SELECT COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'National League' AND T1.Date = '2018-08-07' AND T1.FTR = 'D'
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
world_development_indicators
Which countries have notes on the indicator BX.KLT.DINV.CD.WD?
indicator BX.KLT.DINV.CD.WD refers to Seriescode = 'BX.KLT.DINV.CD.WD'
SELECT T1.ShortName FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode INNER JOIN Series AS T3 ON T2.Seriescode = T3.SeriesCode WHERE T3.Seriescode = 'BX.KLT.DINV.CD.WD'
CREATE TABLE CountryNotes ( primary key (Countrycode, Seriescode), FOREIGN KEY (Seriescode) REFERENCES Series(SeriesCode), Seriescode TEXT NOT NULL, -- Countrycode TEXT NOT NULL, -- Description TEXT, -- FOREIGN KEY (Countrycode) REFERENCES Country(CountryCode), ); CREATE TABLE Series ( BasePeriod TEXT, --...
movie
Among the movies starring Tom Cruise, which one of them has the best quality?
starring Tom Cruise refers to name = 'Tom Cruise'; best quality refers to max(rating)
SELECT T1.Title FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T3.Name = 'Tom Cruise' ORDER BY T1.Rating DESC LIMIT 1
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
student_loan
What is the name of the organization which most of the students are enlisted in?
name of the organization refers to organ; organization which most of the students are enlisted in refers to MAX(COUNT(organ));
SELECT organ FROM ( SELECT organ, COUNT(organ) AS num FROM enlist GROUP BY organ ) T ORDER BY T.num DESC LIMIT 1
CREATE TABLE longest_absense_from_school ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update cascade on delete cascade, "month" INTEGER default 0 null, -- Example Values: `0`, `1`, `2`, `3`, `4` | Value Statics: Total count 1000 - Distinct count 10 - Null count 0 ...
public_review_platform
Which city has the highest number of businesses in the food industry whose number of reviews is high?
highest number of businesses refers to MAX(business_id); food industry refers to category_name = 'Food'; number of reviews is high refers to review_count = 'High';
SELECT T1.city FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.review_count LIKE 'High' AND T3.category_name LIKE 'Food' GROUP BY T1.city
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
movie
Which movie is the character Dr. Archibald 'Moonlight' Graham from?
movie name refers to title; character Dr. Archibald 'Moonlight' Graham refers to character_name = 'Dr. Archibald 'Moonlight' Graham'
SELECT T1.Title FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T2.`Character Name` = 'Dr. Archibald ''Moonlight'' Graham'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
public_review_platform
How many businesses in AZ state have the beer_and_wine attribute?
beer_and_wine refers to attribute_value = 'beer_and_wine';
SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T2.attribute_value LIKE 'beer_and_wine' AND T1.state LIKE 'AZ'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
movie
Please list the names of the movies starring Tom Cruise.
movie name refers to title; starring Tom Cruise refers to name = 'Tom Cruise'
SELECT T1.Title FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T3.Name = 'Tom Cruise'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
mental_health_survey
Please list the IDs of the users who answered "Yes" to the question "Do you think that discussing a physical health issue with your employer would have negative consequences?" in 2014's survey.
2014 refer to SurveyID; Question refer to questiontext; yes refer to AnswerText = 'Yes'
SELECT T2.UserID FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'Do you think that discussing a physical health issue with your employer would have negative consequences?' AND T2.AnswerText LIKE 'Yes' AND T2.SurveyID = 2014
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
public_review_platform
Which city has the least number of businesses whose amount of funny votes is low?
least number of businesses refers to MIN(business_id); funny votes is low refers to review_votes_funny = 'Low';
SELECT T1.city FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T2.review_votes_funny LIKE 'low' GROUP BY T1.city
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
european_football_1
How many teams that played in the 2012 season belong to any of the English divisions and what percentage play in each of the divisions?
matches = Div
SELECT ( SELECT COUNT(T1.Div) AS total FROM matchs T1 INNER JOIN divisions T2 ON T2.division = T1.Div WHERE T2.country = 'England' AND T1.season = 2012 ) AS num , CASE WHEN 1 THEN T.result END AS percentage FROM ( SELECT 100.0 * COUNT(T1.Div) / ( SELECT COUNT(T1.Div) FROM matchs T1 INNER JOIN divisions T2 ON T2.divisio...
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
movie
Please list the names of the actors who played a role in the movie Batman.
movie Batman refers to title = 'Batman'
SELECT T3.Name FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T1.Title = 'Batman'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
mental_health_survey
What is the percentage of the the users who would bring up a mental health issue with a potential employer in an interview?
Percentage = DIVIDE(SUM(AnswerText = 'Yes' Or AnswerText = 'Maybe'), COUNT(QuestionID = 12))* 100
SELECT CAST(SUM(CASE WHEN T1.AnswerText LIKE 'Yes' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 12
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
world_development_indicators
By how much did the indicator on Adolescent fertility rate increase from 1960 to 1961 in the country whose Alpha2Code is 1A?
by how much = subtract(sum(value where Year = 1961), sum(value where Year = 1960)); indicator on Adolescent fertility rate refers to IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)%'
SELECT ( SELECT T2.Value FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' AND T2.Year = 1961 ) - ( SELECT T2.Value FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.Count...
CREATE TABLE CountryNotes ( primary key (Countrycode, Seriescode), FOREIGN KEY (Seriescode) REFERENCES Series(SeriesCode), Seriescode TEXT NOT NULL, -- Countrycode TEXT NOT NULL, -- Description TEXT, -- FOREIGN KEY (Countrycode) REFERENCES Country(CountryCode), ); CREATE TABLE Series ( BasePeriod TEXT, --...
movie
Please list the names of the characters in the movie Look Who's Talking.
movie Look Who's Talking refers to title = 'Look Who's Talking'
SELECT T2.`Character Name` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T1.Title = 'Look Who''s Talking'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
movie
Which character has the longest screen time in the movie Batman?
longest screen time refers to max(screentime); movie Batman refers to title = 'Batman'
SELECT T2.`Character Name` FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID WHERE T1.Title = 'Batman' ORDER BY T2.screentime DESC LIMIT 1
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
mental_health_survey
Please list all the answers to the question "Any additional notes or comments" that are not null in 2014's survey.
question refers to questiontext; the answers that are not null refers to AnswerText ! = -1
SELECT T2.AnswerText FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'Any additional notes or comments' AND T2.SurveyID = 2014 AND T2.AnswerText <> -1
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
public_review_platform
How many businesses in the fashion industry are rated 5 stars?
fashion industry refers to category_name = 'Fashion';
SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.stars = 5 AND T3.category_name LIKE 'Fashion'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
european_football_1
For a game had a score of 1-8 in the year of 2011, what division was that game in? Give the full name of the division.
2011 refers to season; a score of 1-8 refers to FTHG = '1' and FTAG = '8';
SELECT T2.division, T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2011 AND T1.FTHG = 1 AND T1.FTAG = 8
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
public_review_platform
How many users who started yelping since 2012 have sent a high number of funny votes?
users who started yelping in 2012 refers to user_yelping_since_year = '2012'; high number of funny votes refers to user_votes_funny = 'High';
SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year = 2012 AND user_votes_funny LIKE 'High'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
european_football_1
How many Away Victories happened on 2016/3/27 in the LaLiga 2 division?
Away victories refer to FTR = 'A'; LaLiga 2 is the name of division; Date = '2016-03-27';
SELECT COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga 2' AND T1.Date = '2016-03-27' AND T1.FTR = 'A'
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
mental_health_survey
How many users answered "No" to the question "Would you bring up a mental health issue with a potential employer in an interview?" in 2014's survey?
2014 refer to SurveyID; Answered No refer to AnswerText = 'No'; Question refer to questiontext
SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T1.questiontext = 'Would you bring up a mental health issue with a potential employer in an interview?' AND T2.SurveyID = 2014 AND T2.AnswerText LIKE 'NO'
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
public_review_platform
Please list all business IDs in Mesa city that review stars of over 3.
stars > 3;
SELECT T1.business_id FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Mesa' AND T2.review_stars > 3 GROUP BY T1.business_id
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
movie
Which actor played the role of Joker in the movie Batman?
role of Joker refers to character_name = 'Joker'; movie Batman refers to title = 'Batman'
SELECT T3.Name FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON T3.ActorID = T2.ActorID WHERE T1.Title = 'Batman' AND T2.`Character Name` = 'Joker'
CREATE TABLE actor ( "Date of Birth" DATE, -- "Birth City" TEXT, -- Biography TEXT, -- Name TEXT, -- Gender TEXT, -- Example Values: `Male`, `Female` | Value Statics: Total count 1172 - Distinct count 2 - Null count 1541 ActorID INTEGER constraint actor_pk primary key, Ethnicity TEXT, -- Example Value...
public_review_platform
What are the attribute numbers that are related to payment?
attribute numbers refers to attribute_id; related to payment refers to attribute_name like '%payment%';
SELECT attribute_id FROM Attributes WHERE attribute_name LIKE '%payment%'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
mental_health_survey
Please list all the questions in the mental health survey for 2014.
mental health survey for 2014 refers to SurveyID = 2014
SELECT T2.questiontext FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid INNER JOIN Survey AS T3 ON T1.SurveyID = T3.SurveyID WHERE T3.Description LIKE 'mental health survey for 2014' GROUP BY T2.questiontext
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
public_review_platform
What percentage of businesses are in the Real Estate sector and have the rating of 5 out of all businesses in Chandler?
Real Estate sector refers to category_name = 'Real Estate'; rating of 5 refers to stars = 5; Chandler refers to city = 'Chandler'; percentage = MULTIPLY(DIVIDE(SUM(category_name = 'Real Estate' and stars = 5), COUNT(business_id)), 100);
SELECT CAST(SUM(CASE WHEN T1.stars = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.business_id) AS "percentage" FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.city LIKE 'Chan...
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
european_football_1
Which country had the game that Away team made the most goals?
the most goals refer to MAX(FTAG), which is a short name for Final-time Away-team Goals;
SELECT T2.country FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division GROUP BY T2.country ORDER BY SUM(T1.FTAG) DESC LIMIT 1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
mental_health_survey
How many users participated in the mental health survey for 2014?
mental health survey for 2014 refers to SurveyID = 2014
SELECT COUNT(DISTINCT T1.UserID) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2014'
CREATE TABLE Answer ( SurveyID INTEGER constraint Answer_Survey_SurveyID_fk references Survey, -- Example Values: `2014`, `2016`, `2017`, `2018`, `2019` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 QuestionID INTEGER constraint Answer_Question_questionid_fk references Question, -- UserI...
public_review_platform
How many businesses are actively running in Gilbert City?
actively running refers to active = 'true';
SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Gilbert' AND active LIKE 'True'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
european_football_1
Give the full name of the divison that had the most 0-0 games.
the most 0-0 games means a no-score draw and refers to MAX(COUNT(Div where FTHG = '0' and FTAG = '0'));
SELECT T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.FTAG = 0 AND T1.FTHG = 0 GROUP BY T2.division ORDER BY COUNT(T1.FTAG) DESC LIMIT 1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, -- country TEXT, -- Example Values: `Belgium`, `Deutschland`, `England`, `France`, `Greece` | Value Statics: Total count 21 - Distinct count 11 - Null count 0 ); CREATE TABLE matchs ( Date DATE, -- HomeTeam TEXT, -- season INTEGER, ...
public_review_platform
What is the number of useful votes that the user 52592 received when reviewed for business number 2?
number of useful votes refers to review_votes_useful; business number refers to business_id;
SELECT review_votes_useful FROM Reviews WHERE user_id = 52592 AND business_id = 2
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...