db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
mental_health_survey
How many users lived in Canada according to 2018's survey?
lived in Canada refers to AnswerText(QuestionID(3)) = 'Canada'
SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2018 AND T1.questiontext = 'What country do you live in?' AND T2.AnswerText = 'Canada'
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 state any three business numbers in AZ state that have received the "Great experience" review stars.
business numbers refers to business_id; great experience review stars refers to review_stars = 5;
SELECT DISTINCT T2.business_id FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T2.state LIKE 'AZ' AND T1.review_stars = 5 LIMIT 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
Of all the divisions in the world, what percentage of them belong to England?
DIVIDE(COUNT(division where country = 'England'), COUNT(division)) as percentage;
SELECT CAST(COUNT(CASE WHEN country = 'England' THEN division ELSE NULL END) AS REAL) * 100 / COUNT(division) FROM divisions
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
What is the note for Australia on the indicator SP.ADO.TFRT?
note refers to Description; for Australia refers to ShortName = 'Australia'; indicator SP.ADO.TFRT refers to Seriescode = 'SP.ADO.TFRT'
SELECT T2.Description FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Seriescode = 'SP.ADO.TFRT' AND T1.ShortName = 'Australia'
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, --...
trains
What are the load shapes of all the short ellipse cars?
short refers to len = 'short'; ellipse cars refers to shape = 'ellipse'
SELECT load_shape FROM cars WHERE shape = 'ellipse' AND len = 'short'
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...
trains
How many short cars are in the shape of hexagon?
short cars refers to len = 'short'; in the shape of hexagon refers to shape = 'hexagon'
SELECT COUNT(id) FROM cars WHERE shape = 'hexagon' AND len = 'short'
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...
mental_health_survey
How many users answered "Yes" to the question "Have you had a mental health disorder in the past?" in 3 consecutive years starting from 2016?
question refers to questiontext; answered 'Yes' to question refers to AnswerText = 'Yes'; 3 consecutive years starting from 2016 refers to SurveyID = 2016 and SurveyID = 2017 and SurveyID = 2018
SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID IN (2016, 2017, 2018) AND T1.questiontext LIKE 'Have you had a mental health disorder in the past?' AND T2.AnswerText = '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 long was the review for business number 2 that user number 612 wrote?
how long was the review refers to review_length; business number refers to business_id; user number refers to user_id;
SELECT review_length FROM Reviews WHERE user_id = 612 AND review_stars = 5 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 ...
european_football_1
Which country did Bradford Team belongs to?
Bradford team refers to HomeTeam = 'Bradford' or AwayTeam = 'Bradford';
SELECT DISTINCT T2.country FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.HomeTeam = 'Bradford' OR T1.AwayTeam = 'Bradford'
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 "cool" compliments did user number 33 receive?
cool compliments refers to compliment_type = 'cool'; user number refers to user_id;
SELECT COUNT(T2.compliment_type) FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.user_id = 33 AND T2.compliment_type LIKE 'cool'
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 division had the most games with more than 5 total field goals on 2020/2/22? Give the full name of the division?
more than 5 total field goals refers to SUM(FTHG, FTAG)>5, which are short names for Final-time Home-team Goals and Final-time Away-team Goals; 2020/2/22 is a date;
SELECT T2.division, T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2020-02-22' AND T1.FTAG + T1.FTHG > 5 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, ...
world_development_indicators
In Sub-Saharan Africa, how many female out-of-school children of primary school age are there in the country with the higest number of female out-of-school children of primary school age? Indicate the year of when it was recorded.
in Sub-Saharan Africa refers to Region = 'Sub-Saharan Africa'; the higest number of female out-of-school children of primary school age refers to max(value where IndicatorName = 'Out-of-school children of primary school age, female (number)')
SELECT MAX(T1.value), T1.year FROM indicators AS T1 INNER JOIN country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Region = 'Sub-Saharan Africa' AND T1.IndicatorName = 'Out-of-school children of primary school age, female (number)'
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
Count the male actors born in USA that starred in Ghost.
male refers to Gender = 'Male'; born in USA refers to Birth Country = 'USA'; Ghost refers to Title = 'Ghost'
SELECT COUNT(*) 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 = 'Ghost' AND T3.Gender = 'Male' AND T3.`Birth Country` = 'USA'
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 common questions in 2014's survey and 2016's survey.
question refers to questiontext; all the common questions in 2014's survey and 2016's survey refers to QuestionID(SurveyID(2014)) = QuestionID(SurveyID(2016))
SELECT T1.questiontext FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID IN (2014, 2016) GROUP BY T1.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
How many businesses in the AZ state got low quality of reviews?
low quality of reviews refers to review_count = 'low';
SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND review_count LIKE 'Low'
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
List the number of games that ended up with 5-0 in Greece.
5-0 is a score where FTHG = '5' and FTAG = '0'; Greece is a name of country; games refer to Div;
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.country = 'Greece' AND T1.FTHG = 5 AND T1.FTAG = 0
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 is the percentage of all the trains with at least 4 cars? List the directions of the said trains.
at least 4 cars refers to trailPosi > = 4; calculation = MULTIPLY(DIVIDE(count(trailPosi > = 4 then id), count(id)), 100)
SELECT CAST(COUNT(CASE WHEN T2.trailPosi >= 4 THEN T1.id ELSE NULL END) AS REAL) * 100 / COUNT(T1.id) FROM trains AS T1 INNER JOIN ( SELECT train_id, MAX(position) AS trailPosi FROM cars GROUP BY train_id ) AS T2 ON T1.id = T2.train_id UNION ALL SELECT T1.direction FROM trains AS T1 INNER JOIN ( SELECT train_id, MAX(po...
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...
european_football_1
Which 2 Scottish teams scored 10 goals playing as a local team and in which seasons?
local team refers to HomeTeam; Scottish means belong to the country = 'Scotland'; scored 10 goals refer to FTHG = 10, which is short name for Final-time Away-team Goals;
SELECT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.country = 'Scotland' AND T1.FTHG = 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
What is the net worth of the actor starred in Misery who has a height ranging from 60 to 70 inches tall?
Misery refers to Title = 'Misery'; height ranging from 60 to 70 inches refers to Height (Inches) BETWEEN 60 and 70
SELECT T3.NetWorth 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 = 'Misery' AND T3.`Height (Inches)` BETWEEN 60 AND 70 AND T3.Gender = 'Male'
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 attributes that business number 56 have?
business number refers to business_id; attributes that business have refers to attribute_value = 'true';
SELECT T1.attribute_name FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_value LIKE 'TRUE' AND T2.business_id = 56
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 home win ratio of the Bundesliga division in 2021?
home win refers to FTR = 'H', where H stands for home victory; season = '2021'; Bundesliga is a name of division; DIVIDE(COUNT(Div where FTR = 'H, season = '2021' and name = 'Bundesliga'), COUNT(Div where season = '2021' and name = 'Bundesliga')) as percentage;
SELECT CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T2.name = 'Bundesliga'
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
List all the load shapes of all head cars of each train and identify which load shape has the highest number. Calculate the percentage of the trains with the said head car that are running eas
which load shape has the highest number refers to MAX(load_shape); head car refers to position = 1; east is a direction; calculation = MULTIPLY(DIVIDE(count(direction = 'east' where MAX(load_shape) where position = 1 then id), count(id)), 100)
SELECT DISTINCT T3.load_shape FROM ( SELECT load_shape, train_id FROM cars WHERE position = 1 ORDER BY train_id DESC ) AS T3 UNION ALL SELECT T4.load_shape FROM ( SELECT load_shape, train_id FROM cars WHERE position = 1 ORDER BY train_id DESC LIMIT 1 ) AS T4 UNION ALL SELECT (CAST(COUNT(DISTINCT CASE WHEN T2.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...
mental_health_survey
According to 2016's survey, what is the number of users with a mental health disorder in the past?
users with a mental health disorder in the past refers to AnswerText(QuestionID(32)) = 'Yes'
SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2016 AND T1.questiontext LIKE 'Have you had a mental health disorder in the past?' AND T2.AnswerText = '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...
european_football_1
From the Spanish LaLiga division in the 2017 season, which team won the most times as a local team and by what percentage?
local team refers to HomeTeam; Spanish means belong to the country = 'Spain'; LaLiga is a name of division; won as a local team refers to FTR = 'H', where H stands for home victory; DIVIDE(COUNT(Div where name = 'LaLiga', country = 'Spain', season = 2017, FRT = 'H'), COUNT(Div where name = 'LaLiga', country = 'Spain', ...
SELECT T1.HomeTeam HWHT , CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga' AND T2.country = 'Spain' AND T1.season = 2017
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 that have at least one non-regular shaped car, what is the percentage of it running in the east direction?
non-regular shaped car refers to shape in ('bucket', 'ellipse'); calculation = MULTIPLY(DIVIDE(count(direction = 'east' then train_id)), count(train_id), 100)
SELECT CAST(COUNT(DISTINCT CASE WHEN T2.direction = 'east' THEN T1.train_id ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT T1.train_id) FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.shape IN ('bucket', 'ellipse')
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...
public_review_platform
Please name one attribute that business number 2 does not have.
business number refers to business_id; business_id = 2; does not have refers to attribute_value = 'none';
SELECT T1.attribute_name FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_value LIKE 'none' LIMIT 1
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
Among the actors starred in Die Hard 2, list their net worth and birth date of actors with a height between 60 to 65.
Die Hard 2 refers to Title = 'Die Hard 2'; height between 60 to 65 refers to Height (Inches) BETWEEN 60 AND 65
SELECT T3.NetWorth, T3.`Date of Birth` 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 = 'Die Hard 2' AND T3.`Height (Inches)` BETWEEN 60 AND 65
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 rate of increase of users with a current mental disorder from 2019's survey to 2016's survey?
rate of increase = subtract(divide(count(SurveyID = 2019& QuestionID = 33& AnswerText = 'Yes'), count(SurveyID = 2019& QuestionID = 33)), divide(count(SurveyID = 2016& QuestionID = 33& AnswerText = 'Yes'), count(SurveyID = 2016& QuestionID = 33)))
SELECT CAST(( SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2019 AND T1.questiontext LIKE 'Do you currently have a mental health disorder?' AND T2.AnswerText = 'Yes' ) - ( SELECT COUNT(T2.UserID) FROM Question AS T1 INNER JOIN Answer AS T2 ON T1...
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 Scottsdale city under the category of "Beauty & Spas"?
category refers to category_name;
SELECT COUNT(T2.business_id) 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 WHERE T3.city LIKE 'Scottsdale' AND T1.category_name LIKE 'Beauty & Spas'
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 Eredivisie teams have played in 2008?
Eredivisie is the name of division; 2008 refers to season; teams refer to HomeTeam;
SELECT COUNT(DISTINCT T1.HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Eredivisie' AND T1.season = 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, ...
movie
Find the actor's name that played as Don Altobello in a drama movie that has a gross of 136766062.
actor's name refers to Name; as Don Altobello refers to Character Name = 'Don Altobello'; drama movie refers to Genre = 'Drama'
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.Gross = 136766062 AND T2.`Character Name` = 'Don Altobello' AND T1.Genre = 'Drama'
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
Among the students that have a payment due, how many students are unemployed?
students that have a payment due refers to bool = 'pos';
SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name WHERE T1.bool = 'pos'
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 are the opening hours of business number 53 on Friday?
opening hours refers to opening_time; business number refers to business_id; Friday refers to day_of_week = 'Friday';
SELECT T1.closing_time - T1.opening_time AS "opening hours" FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week LIKE 'Friday' AND T1.business_id = 53
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 ...
trains
How many cars running east have double-sided tail cars?
east is an direction; double-sided refers to sides = 'double'; tail refers to carsposition = trailPosi
SELECT COUNT(T1.id) FROM trains AS T1 INNER JOIN cars AS T2 ON T1.id = T2.train_id INNER JOIN ( SELECT train_id, MAX(position) AS trailPosi FROM cars GROUP BY train_id ) AS T3 ON T1.id = T3.train_id WHERE T1.direction = 'east' AND T2.position = T3.trailPosi AND T2.sides = 'double'
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...
public_review_platform
How many businesses operating in the "Accessories" category have received a "wonderful experience" review from users?
Accessories category refers to category_name = 'Accessories'; wonderful experience review refers to stars > 3;
SELECT COUNT(T2.business_id) 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 WHERE T3.stars > 3 AND T1.category_name LIKE 'Accessories'
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 all the games ended up with 1-1, what percentage of them are from Liga NOS division?
1-1 is a score where FTHG = '1' and FTAG = '1'; Liga NOS is the name of division; DIVIDE(COUNT(Div where FTHG = '1', FTAG = '1', name = 'Liga NOS'), COUNT(Div where FTHG = '1' and FTAG = '1')) as percentage;
SELECT CAST(COUNT(CASE WHEN T2.name = 'Liga NOS' THEN T1.Div ELSE NULL END) AS REAL) * 100 / COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.FTHG = 1 AND FTAG = 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
What is the runtime of the movie starred by Jackie Chan with a rating greater than 7?
starred by Jackie Chan refers to Name = 'Jackie Chan'; rating greater than 7 refers to Rating > 7
SELECT T1.Runtime 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 = 'Jackie Chan' AND T1.Rating > 7
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
List the runtime of movies starred by an African-American actor born on December 28, 1954.
African-American refers to Ethnicity = 'African American'; born on December 28 1954 refers to Date of Birth = '1954-12-28'
SELECT T1.Runtime 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.Ethnicity = 'African American' AND T3.`Date of Birth` = '1954-12-28'
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 did user No.5 answer?
user No.5 refers to userID = 5
SELECT COUNT(QuestionID) FROM Answer WHERE UserID = 5
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 are the categories that business number 15 belongs to?
business number refers to business_id;
SELECT T2.category_name FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id WHERE T1.business_id = 15
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 gross of a comedy movie with a rating lower than 7 and starred by an actor with a net worth greater than $375,000,000.00?
comedy movie refers to Genre = 'Comedy'; rating lower than 7 refers to Rating < 7; net worth greater than $375,000,000.00 refers to NetWorth > '$375,000,000.00'
SELECT SUM(T1.Gross) 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 CAST(REPLACE(REPLACE(T3.NetWorth, ',', ''), '$', '') AS REAL) > 375000000 AND T1.Rating < 7 AND T1.Genre = 'Comedy'
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 do not open on Thursday?
do not open on Thursday refers to day_of_week = 'Thursday' AND label_time_4 = 'None';
SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Checkins AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T2.label_time_4 LIKE 'None' AND T1.state LIKE 'AZ' AND T3.day_of_week LIKE 'Thursday'
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
How many movies starring Morgan Freeman are suggested by parental guidance?
'suggested by parental guidance' refers to mpaa_rating = 'PG'
SELECT COUNT(*) 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 = 'Morgan Freeman' AND T1.`MPAA Rating` = 'PG'
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 result of the question "What is your age?" in 2014's survey?
average result refers to avg(AnswerText(SurveyID = 2014& QuestionID = 1))
SELECT CAST(SUM(T2.AnswerText) AS REAL) / COUNT(T2.UserID) AS "avg" FROM Question AS T1 INNER JOIN Answer AS T2 ON T1.questionid = T2.QuestionID WHERE T2.SurveyID = 2014 AND T1.questiontext LIKE 'What is your age?'
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 any two user numbers that have an "Uber" number of cute compliments.
user numbers refers to user_id; Uber number refers to number_of_compliments = 'Uber'; cute compliments refers to compliment_type = 'cute';
SELECT T1.user_id FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.number_of_compliments LIKE 'Uber' AND T2.compliment_type LIKE 'cute' LIMIT 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 ...
regional_sales
Identify the top customer of the store located in Gilbert, Arizona based on net profit associated with the customer relationship in 2019.
"Gilbert" is the City Name; 'Arizona' is the name of State; customer relationship in 2019 refers to ProcuredDate LIKE '%/19'; top net profit refers to Max(Subtract(Unit Price, Unit Cost))
SELECT T1.`Customer Names` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T3.`City Name` = 'Gilbert' AND T2.ProcuredDate LIKE '%/%/19' ORDER BY REPLACE(T2.`Unit Price`, ',', '') - REPLACE(T2.`Unit Cost`, ',', ''...
CREATE TABLE Regions ( State TEXT, -- Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 StateCode TEXT constraint Regions_pk primary key, ); CREATE TABLE Sales Orders ( OrderNumber TEXT constraint "Sales Orders_pk" primary...
movie
List the character's name of actress born in Sherman Oaks and starred in the movie Bruce Almighty with height greater than the 50% of average height of all actors listed.
actress refers to Gender = 'Female'; born in Sherman Oaks refers to Birth City = 'Sherman Oaks'; movie Bruce Almighty refers to Title = 'Bruce Almighty'; height greater than the 50% of average height refers to Height (Inches) > multiply(avg(Height (Inches)), 0.5)
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 T3.Gender = 'Female' AND T1.Title = 'Godzilla' AND T3.`Birth City` = 'Sherman Oaks' AND T3.`Height (Inches)` * 100 > ( SELECT AVG(`Height (Inches)`) FROM actor ) * 50
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
Among the Yelp_Businesses in Arizona, how many of them are still running?
Arizona refers to state = 'AZ'; still running refers to active = 'true';
SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' 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
What is the MPAA rating and title of the movie starred by Leonardo DiCaprio with highest budget?
starred by Leonardo DiCaprio refers to Name = 'Leonardo Dicaprio'; highest budget refers to max(Budget)
SELECT T1.`MPAA Rating`, 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 = 'Leonardo DiCaprio' ORDER BY T1.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...
mental_health_survey
How many users answered the question No.20?
question No.20 refers to QuestionID = 20
SELECT MAX(UserID) - MIN(UserID) + 1 FROM Answer WHERE QuestionID = 20
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 long does business number 12 in Scottsdale stay open on day number 3?
business number refers to business_id; Scottsdale refers to city = 'Scottsdale'; day number refers to day_id;
SELECT T2.closing_time - T2.opening_time AS "hour" FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.business_id = 12 AND T1.city LIKE 'Scottsdale' AND T2.day_id = 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 ...
movie
Among the movies with drama genre, what is the percentage of the actors with net worth greater than $400,000,000.00?
drama genre refers to Genre = 'Drama'; net worth greater than $400,000,000.00 refers to NetWorth > '$400,000,000.00'; percentage = divide(count(ActorID where NetWorth > '$400,000,000.00'), COUNT(ActorID))*100%
SELECT SUM(CASE WHEN CAST(REPLACE(REPLACE(T3.NetWorth, ',', ''), '$', '') AS REAL) > 400000000 THEN 1 ELSE 0 END) - SUM(CASE WHEN CAST(REPLACE(REPLACE(T3.NetWorth, ',', ''), '$', '') AS REAL) < 400000000 THEN 1 ELSE 0 END) FROM movie AS T1 INNER JOIN characters AS T2 ON T1.MovieID = T2.MovieID INNER JOIN actor AS T3 ON...
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
State the number of questions that were asked in the "mental health survey for 2018".
mental health survey for 2018 refers to SurveyID = 2018
SELECT COUNT(T1.QuestionID) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2018'
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 more Yelp_Business that's more appealing to users, Scottsdale or Anthem?
more appealing to users refers to MAX(review_count);
SELECT city FROM Business ORDER BY review_count DESC LIMIT 1
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 team was the home team in the match of the Bundesliga division on 2020/10/2?
Bundesliga is the name of division; Date = '2020/10/2';
SELECT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2020-10-02' AND T2.name = 'Bundesliga'
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
How many trains with fully loaded head cars are running east?
fully loaded refers to load_num = 3; head cars refers to position = 1
SELECT COUNT(DISTINCT T1.train_id) FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.position = 1 AND T1.load_num = 3
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...
social_media
Please list the texts of all the tweets that are reshared.
reshared refers to Isreshare = 'TRUE'
SELECT text FROM twitter WHERE IsReshare = 'TRUE'
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
mental_health_survey
Tell the question ID for "Would you bring up a physical health issue with a potential employer in an interview?".
null
SELECT questionid FROM Question WHERE questiontext LIKE 'Would you bring up a physical health issue with a potential employer in an interview?'
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 of Yelp are in Scottsdale?
Scottsdale refers to city = 'Scottsdale';
SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Scottsdale'
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 matches were held during the 2021 season's Premier League?
Premier League is the name of division;
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T2.name = 'Premier League'
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 is the direction of the train with a diamond-shaped load in its 2nd car?
2nd car refers to position = 2
SELECT T2.direction FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.position = 2 AND T1.shape = 'diamond'
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...
european_football_1
Which team has the most victories as the home team in matches of the Bundesliga division?
Bundesliga is the name of division; the most victories as the home team refers to MAX(COUNT(FTR = 'H'));
SELECT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.FTR = 'H' GROUP BY T1.HomeTeam ORDER BY COUNT(T1.FTR) 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, ...
social_media
How many tweets are in English?
english is the language and refers to Lang = 'en'
SELECT COUNT(TweetID) AS tweet_number FROM twitter WHERE Lang = 'en'
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
mental_health_survey
How many users participated in the Survey No.2016?
Survey No.2016 refers to SurveyID = 2016
SELECT COUNT(DISTINCT UserID) FROM Answer WHERE SurveyID LIKE 2016
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...
trains
Provide the directions for all the trains that have 2 or less cars.
2 or less cars refers to trailPosi < = 2
SELECT T1.direction FROM trains AS T1 INNER JOIN ( SELECT train_id, MAX(position) AS trailPosi FROM cars GROUP BY train_id ) AS T2 ON T1.id = T2.train_id WHERE T2.trailPosi <= 2
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...
student_loan
Calculate the average number of disabled female students enrolled in UCI.
average = DIVIDE(SUM(disabled.name who are not in male.name WHERE school = 'uci'), COUNT(enrolled.name)); female students refers to disabled.name who are NOT in male.name; UCI refers to school = 'uci';
SELECT CAST(SUM(IIF(T1.school = 'uci' AND T4.name IS NULL, 1, 0)) AS REAL) / COUNT(T1.name) FROM enrolled AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name INNER JOIN person AS T3 ON T1.name = T3.name LEFT JOIN male AS T4 ON T3.name = T4.name
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 Yelp_Businesses are there in Arizona in total?
Arizona refers to state = 'AZ';
SELECT COUNT(business_id) FROM Business WHERE 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 ...
european_football_1
Which team won the match of the Bundesliga division on 2020/10/2?
Bundesliga is the name of division; Date = '2020/10/2'; won the match refers to FTR = 'H';
SELECT CASE WHEN T1.FTR = 'H' THEN T1.HomeTeam WHEN T1.FTR = 'A' THEN T1.AwayTeam END WINNER FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2020-10-02' AND T2.name = 'Bundesliga'
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, ...
social_media
Among all the tweets that have a positive sentiment, how many of them are posted on Thursday?
positive sentiment refers to Sentiment > 0; posted on Thursday refers to Weekday = 'Thursday'
SELECT COUNT(TweetID) AS tweet_number FROM twitter WHERE Sentiment > 0 AND Weekday = 'Thursday'
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
mental_health_survey
What answer did user No. 2681 give to the question "Do you currently have a mental health disorder?"?
question refers to questiontext; user No. 2681 refers to UserID = 2681
SELECT T1.AnswerText FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext = 'Do you currently have a mental health disorder?' AND T1.UserID = 2681
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 Yelp_Businesses in Scottsdale have received positive comments in the Elitestar rating?
Scottsdale refers to city = 'Scottsdale'; positive comments refers to stars > 3; Elitestar rating refers to stars;
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 matches of the Bundesliga division ended with an away victory in the 2021 season?
Bundesliga is the name of division; away victory refers to FTR = 'A', where 'A' stands for away victory;
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.FTR = 'A' AND T1.season = 2021
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
List all the directions of the trains that have empty cars.
empty cars refers to load_num = 0
SELECT T2.direction FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.load_num = 0
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...
public_review_platform
How many reviews have the user whose ID is 3 posted?
null
SELECT COUNT(review_length) FROM Reviews WHERE user_id = 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 ...
social_media
How many tweets are seen by more than 1000 unique users?
seen by more than 1000 unique users refers to Reach > 1000
SELECT COUNT(TweetID) AS tweet_number FROM twitter WHERE Reach > 1000
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
student_loan
Among students with 1 month of absenses, how many of them are enlisted in the air force department?
1 month of absences refers to month = 1; department refers to organ; organ = 'air_force';
SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T1.month = 1 AND T2.organ = 'air_force'
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 ...
european_football_1
Please list the home teams in the matches of the Bundesliga division that ended with a home victory in the 2021 season.
Bundesliga is the name of division; home victory refers to refer to FTR = 'H', where H stands for home victory;
SELECT DISTINCT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T1.FTR = 'H' AND T2.name = 'Bundesliga'
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, ...
social_media
Please list all the cities in Argentina.
"Argentina" is the Country
SELECT City FROM location WHERE City IS NOT NULL AND Country = 'Argentina'
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
mental_health_survey
What was the most common answer for the question "What country do you work in?"?
most common answer refers to AnswerText where MAX(COUNT(AnswerText(QuestionID = 3)))
SELECT T1.AnswerText FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext = 'What country do you work in?' GROUP BY T1.AnswerText ORDER BY COUNT(T1.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...
public_review_platform
How many Yelp_Businesses in Arizona have a Elitestar rating of over 4?
Arizona refers to state = 'AZ'; Elitestar rating of over 4 refers to stars > 4;
SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND stars > 4
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 the team Werder Bremen win as the away team in matches of the Bundesliga division?
Bundesliga is the name of division; win as the away team refers to FTR = 'A', where 'A' stands for away victory;
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.AwayTeam = 'Werder Bremen' 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, ...
trains
Among the trains running west, how many trains have three-wheeled, jagged roof cars?
west is an direction; three-wheeled refers to wheels = 3; jagged roof refers to roof = 'jagged'
SELECT SUM(CASE WHEN T2.direction = 'west' THEN 1 ELSE 0 END)as count FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.wheels = 3 AND T1.roof = 'jagged'
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...
social_media
Among all the tweets that are reshared, how many of them are posted by a user in Buenos Aires?
reshared refers to Isreshare = 'TRUE'; 'Buenos Aires' is the City
SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.City = 'Buenos Aires' AND T1.IsReshare = 'TRUE'
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
mental_health_survey
Tell the number of surveys that contained the question “What country do you work in?”.
question refers to questiontext
SELECT COUNT(DISTINCT T1.QuestionID) 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 T2.questiontext = 'What country do you work in?'
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
Among the long reviews made by user ID 3, how many of them have received a medium number of useful votes?
long reviews refers to review_length = 'Long'; medium number of useful votes refers to review_votes_useful = 'medium';
SELECT COUNT(review_length) FROM Reviews WHERE user_id = 3 AND review_length LIKE 'Long' AND review_votes_useful 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 ...
social_media
What is the text of the tweet that got the most `likes`?
got the most like refers to Max(Likes)
SELECT text FROM twitter WHERE Likes = ( SELECT MAX( Likes) FROM twitter )
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
mental_health_survey
How many people wrote comments for the question "Any additional notes or comments."?
question refers to questiontext; wrote comments refers to AnswerText(QuestionID = 103) ! = -1
SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext LIKE 'Any additional notes or comments' AND T1.AnswerText IS NOT NULL
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 home victories does the Bundesliga division have in more or less than the Premier League division in the 2021 season?
Bundesliga and the Premier League are names of division; home victories refer to FTR = 'H', where H stands for home victory; SUBTRACT(COUNT(FTR = 'H' where season = 2021, name = 'Bundesliga'), COUNT(FTR = 'H' where season = 2021, name = 'Premier League'));
SELECT COUNT(CASE WHEN T2.name = 'Bundesliga' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T2.name = 'Premier League' THEN 1 ELSE NULL END) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 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, ...
social_media
Users in which city of Argentina post the most tweets?
"Argentina" is the Country; post the most tweets refers to Max(Count(TweetID))
SELECT T2.City FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.Country = 'Argentina' GROUP BY T2.City ORDER BY COUNT(T1.TweetID) DESC LIMIT 1
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
movie_platform
Who is the director of the movie Sex, Drink and Bloodshed?
Sex, Drink and Bloodshed refers to movie title = 'Sex, Drink and Bloodshed';
SELECT director_name FROM movies WHERE movie_title = 'Sex, Drink and Bloodshed'
CREATE TABLE ratings_users ( user_cover_image_url TEXT, -- user_avatar_image_url TEXT, -- rating_date_utc TEXT, -- user_trialist INTEGER, -- Example Values: `0`, `1` | Value Statics: Total count 100000 - Distinct count 2 - Null count 0 user_has_payment_method INTEGER, -- Example Values: `0`, `1` | Value S...
mental_health_survey
Provide the number of users who took part in the "mental health survey for 2016".
mental health survey for 2016 refers to SurveyID = 2016
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 2016'
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...
regional_sales
What was the best discount applied to sales orders in 2020?
sales orders in 2020 refers to Substr(OrderDate, -2) = '20'; best discount applied refers to Max(Discount Applied)
SELECT MAX(`Discount Applied`) FROM `Sales Orders` WHERE OrderDate LIKE '%/%/20'
CREATE TABLE Regions ( State TEXT, -- Region TEXT, -- Example Values: `South`, `West`, `Northeast`, `Midwest` | Value Statics: Total count 48 - Distinct count 4 - Null count 0 StateCode TEXT constraint Regions_pk primary key, ); CREATE TABLE Sales Orders ( OrderNumber TEXT constraint "Sales Orders_pk" primary...
trains
Please list the directions in which the trains with 4 short cars run.
short refers to len = 'short'; 4 cars run refers to position = 4
SELECT T2.direction FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.len = 'short' AND T1.position = 4
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...
mental_health_survey
For the question “What US state or territory do you work in?”, how many people gave "Kansas" as the answer?
question refers to questiontext; AnswerText = 'Kansas'
SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext LIKE 'What US state or territory do you work in?' AND T1.AnswerText = 'Kansas'
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 the cities of the Yelp_Businesses that have gotten a 5 in the Elitestar rating.
5 in the Elitestar rating refers to stars = 5;
SELECT city FROM Business WHERE stars = 5 GROUP BY 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
Which team had the most final-time home-team goals in the 2021 season's matches of the Bundesliga division?
Bundesliga is the name of division; the most final-time home-team goals refers to MAX(FTHG);
SELECT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.season = 2021 ORDER BY 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, ...
world_development_indicators
From 1975 to 1980, how much is the total amount CO2 emmission in kiloton of the the world? Indicate which year the world recorded its highest CO2 emmissions.
from 1975 to 1980 refers to Year between 1975 and 1980; the total amount CO2 emmission in kiloton of the the world refers to sum(value where IndicatorName like 'CO2%'); the world recorded its highest CO2 emmissions refers to max(value where IndicatorName like 'CO2%')
SELECT SUM(T1.Value), T1.Year FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IndicatorName = 'CO2 emissions (kt)' AND T1.Year >= 1975 AND T1.Year < 1981 AND T1.CountryCode = 'WLD' AND T2.SpecialNotes = 'World aggregate.'
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, --...
social_media
From which country is the tweet with the most likes posted?
tweet with the most likes refers to Max(Likes)
SELECT T2.Country FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID ORDER BY T1.Likes DESC LIMIT 1
CREATE TABLE location ( StateCode TEXT, -- LocationID INTEGER constraint location_pk primary key, City TEXT, -- Country TEXT, -- State TEXT, -- ); CREATE TABLE twitter ( Reach INTEGER, -- Lang TEXT, -- Klout INTEGER, -- foreign key (LocationID) references location(LocationID), Hour INTEGER, -- ...
public_review_platform
How many reviews made by user whose ID is 3 are long?
long refers to review_length = 'Long';
SELECT COUNT(review_length) FROM Reviews WHERE user_id = 3 AND review_length LIKE 'Long'
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 the matches in all seasons of the Bundesliga division, how many of them ended with a tie?
Bundesliga is the name of division; tie refers to FTR = 'D', where D stands for draft;
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' 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, ...