db_id stringclasses 66
values | question stringlengths 24 325 | evidence stringlengths 1 673 ⌀ | gold_query stringlengths 23 804 | db_schema stringclasses 66
values |
|---|---|---|---|---|
social_media | How many tweets in total were posted by a user in Argentina? | "Argentina" is the Country | SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.Country = 'Argentina' 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, -- ... |
mental_health_survey | Give the number of users who took the "mental health survey for 2018". | mental health survey for 2018 refers to SurveyID = 2018 | 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 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 | Please list the businesses names whose length of user review is long with business id from 1 to 20. | businesses names refers to business_id; length of user review is long refers to review_length = 'Long'; business_id BETWEEN 1 AND 20; | SELECT T4.category_name FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T1.review_length LIKE 'Long' AND T3.category_id BETWEEN 1 AND 20 GROUP BY T... | 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 | Among all the users that have posted a tweet with over 1000 likes, how many of them are male? | over 1000 likes refers to Likes > 1000; 'Male' is the Gender of user | SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Likes > 10 AND T2.Gender = 'Male' | 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, -- ... |
european_football_1 | What's the winning rate of Club Brugge in the 2021 Premier League? | Premier League is name of division; season = 2021; Club Brugge is name of team; Club Brugge wins implies HomeTeam = 'Club Brugge' and FTR = 'H' and AwayTeam = 'Club Brugge' and FTR = 'A'; DIVIDE(SUM(COUNT(FTR = 'H' where HomeTeam = 'Club Brugge', name = 'Premier League', season = 2021), COUNT(FTR = 'A'where AwayTeam = ... | SELECT CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) + COUNT(CASE WHEN T1.FTR = 'A' 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 T1.AwayTeam = 'Club Brugge' OR T1.HomeTeam = 'Club Brugge' | 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 the texts of all the tweets posted from Buenos Aires with a positive sentiment. | "Buenos Aires" is the City; positive sentiment refers to Sentiment > 0 | SELECT T1.text FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.Sentiment > 0 AND T2.City = 'Buenos Aires' | 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 different answers did the question "Describe the conversation you had with your previous employer about your mental health, including their reactions and actions taken to address your mental health issue/questions." get? | null | SELECT COUNT(DISTINCT T1.AnswerText) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext LIKE 'Describe the conversation you had with your previous employer about your mental health, including their reactions and actions taken to address your mental health issue/questions.... | 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... |
social_media | Among all the tweets posted from Buenos Aires, how many of them were posted on Thursdays? | "Buenos Aires" is the City; posted on Thursday refers to Weekday = 'Thursday' | 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.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, -- ... |
movie_platform | What is the name of the most followed list? | most followed list refers to MAX(list_followers); | SELECT list_title FROM lists ORDER BY list_followers DESC LIMIT 1 | 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 | For all the users who have been asked "Have you ever been diagnosed with a mental health disorder?", how many of them said "Yes"? | have asked refers to questiontext; said 'Yes' refers to AnswerText = 'Yes' | SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext LIKE 'Have you ever been diagnosed with a mental health disorder?' AND T1.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 | Which businesses are no longer in business but have a low number of votes useful? | no longer in business refers to active = 'False'; low number of votes useful refers to review_votes_useful = 'Low'; | SELECT DISTINCT T1.business_id FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T2.active LIKE 'FALSE' AND T1.review_votes_useful 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 | Which team had more home victories in the 2021 season's matches of the Bundesliga division, Augsburg or Mainz? | Bundesliga is the name of division; more home victories refer to MAX(FTR = 'H)'; Augsburg and Mainz are names of teams and refer to HomeTeam; | SELECT CASE WHEN COUNT(CASE WHEN T1.HomeTeam = 'Augsburg' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T1.HomeTeam = ' Mainz' THEN 1 ELSE NULL END) > 0 THEN 'Augsburg' ELSE 'Mainz' 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, ... |
trains | What is the average number of cars on trains that run in the east direction? | calculation = DIVIDE(count(id), count(train_id)) | SELECT CAST(COUNT(T1.id) AS REAL) / COUNT(DISTINCT T1.train_id) FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T2.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... |
mental_health_survey | For which question did the user No.2183 gave the answer "Mood Disorder (Depression, Bipolar Disorder, etc)"? | question refers to questiontext; user No.2183 refers to userID = 2183 | SELECT T1.AnswerText FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questionid = 2183 AND T1.AnswerText = 'Mood Disorder (Depression, Bipolar Disorder, etc)' | 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 | Provide name of businesses whose category is pets and are still opened after 9PM. | category refers to category_name; open after 9pm refers to closing_time > '9PM'; | SELECT T3.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 INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T4.closing_time > '9PM' AND T1.category_name LIKE 'Pets' | 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 ... |
professional_basketball | List the team name and the total wins of the team in year 2005 which has greater winning from the previous year. | 2005 refers to year = 2005 ; previous year refers to year = 2004; team with greater winning than previous year refers to Won where year = 2005 > Won where year = 2004; team name refers to tmID | SELECT T1.name, T1.won FROM teams AS T1 INNER JOIN ( SELECT * FROM teams WHERE year = 2004 ) AS T2 on T1.tmID = T2.tmID WHERE T1.year = 2005 and T1.won > T2.won | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
social_media | What is the gender of the user who has posted the tweet that is seen by the most number of unique users? | seen by the most number of unique users refers to Max(Reach) | SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID ORDER BY T1.Reach 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, -- ... |
student_loan | How many students enlisted in the Navy? | Navy refers to organ = 'navy'; | SELECT COUNT(name) FROM enlist WHERE organ = 'navy' | 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 | How many final-time home-team goals were there in total in all the matches of the Bundesliga division in the 2021 season? | Bundesliga is the name of division; final-time home-team goals refers to FTHG; | SELECT SUM(T1.FTHG) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' 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, ... |
social_media | Users in which country has posted more numbers of positive tweets, Argentina or Australia? | "Argentina" and "Australia" are both Country; positive tweets refers to Sentiment > 0; Country posted more number of tweets refers to Country where Max(Count(TweetID)) | SELECT T2.Country FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.Country IN ('Argentina', 'Australia') AND T1.Sentiment > 0 GROUP BY T2.Country 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, -- ... |
public_review_platform | Please indicate the review count of the "active life" businesses in Phoenix. | active life refers to category_name = 'Active Life'; Phoenix refers to city = 'Phoenix'; | SELECT COUNT(*) 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 T1.category_name = 'Active Life' AND T3.city = 'Phoenix' | 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 ... |
professional_basketball | Which team(s) has greater than 75% lost among all the games played. | greater than 75% lost refers to Divide(lost, games) > 0.75; team refers to tmID | SELECT name FROM teams WHERE CAST(lost AS REAL) * 100 / games > 75 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
mental_health_survey | Among respondents who participated in the survey in 2016, what percentage had a mental health disorder in the past? | respondents and 'users' are synonyms; percentage = divide(count(SurveyID = 2016& QuestionID = 32 & AnswerText = 'Yes'), count(SurveyID = 2016& QuestionID = 32))*100% | SELECT CAST(SUM(CASE WHEN T1.AnswerText LIKE 'Yes' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.SurveyID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.QuestionID = 32 AND T1.SurveyID = 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... |
european_football_1 | What percentage of games won, games lost and games drawn does Cittadella have as a home team in total? | Percentage of games won = DIVIDE(COUNT(FTR = 'H' where HomeTeam = 'Cittadella'), COUNT(Div where HomeTeam = 'Cittadella')) as percentage; Percentage of games lost = DIVIDE(COUNT(FTR = 'A' where HomeTeam = 'Cittadella')), COUNT(Div where HomeTeam = 'Cittadella') as percentage; percentage of games drawn = DIVIDE(SUM(FTR ... | SELECT CAST(COUNT(CASE WHEN FTR = 'H' THEN 1 ELSE NULL END) / COUNT(HomeTeam) AS REAL) * 100, CAST(COUNT(CASE WHEN FTR = 'A' THEN 1 ELSE NULL END) AS REAL) / COUNT(HomeTeam), CAST(COUNT(CASE WHEN FTR = 'D' THEN 1 ELSE NULL END) AS REAL) / COUNT(HomeTeam) FROM matchs WHERE HomeTeam = 'Cittadella' | 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 the texts of all the tweets posted by male users from Buenos Aires. | "Buenos Aires" is the City; male user refers to Gender = 'Male' | SELECT T1.text FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T2 ON T2.UserID = T1.UserID INNER JOIN user AS T3 ON T1.UserID = T3.UserID WHERE T2.City = 'Buenos Aires' AND T3.Gender = 'Male' | 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, -- ... |
professional_basketball | What is the percentage of the teams who had post season (playoff) were ranked number 1? | had post season (play off) refers to playoff is not null; percentage = Divide (Count(Team where rank = 1, Count(Team))) * 100 | SELECT CAST(SUM(CASE WHEN rank = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(name) FROM teams | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
world_development_indicators | How many countries have a latest population census in 2011? Indicate their full names. | have a latest population census in 2011 refers to LatestPopulationCensus = '2011'; full name refers to LongName | SELECT COUNT(LongName) FROM country WHERE LatestPopulationCensus = '2011' UNION ALL SELECT LongName FROM country WHERE LatestPopulationCensus = '2011' | 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 | How many tweets have the male users posted in total? | male users refers to Gender = 'Male'; total tweets refers to Count(TweetID) | SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T2.Gender = 'Male' | 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 answered the question "Overall, how much importance does your employer place on physical health?"? | question refers to questiontext | SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T2.questiontext LIKE 'Overall, how much importance does your employer place on physical health?' | 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 Yelp business which had the most number of "long" reviews, which category does it belong to? | long reviews refers to review_length = 'long'; most number of long reviews refers to MAX(COUNT(review_length = 'long')); category refers to category_name; | SELECT T4.category_name FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T1.review_length LIKE 'Long' GROUP BY T2.business_id ORDER BY COUNT(T1.revi... | 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 ... |
professional_basketball | Among the winning game from the team, what is the percentage of the winning was home game. | percentage of winning at the home = Divide(homeWon, won) * 100 | SELECT CAST(homeWon AS REAL) * 100 / won FROM teams | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
social_media | Give the number of users who do not show their genders. | do not show their gender refers to Gender = 'Unknown' | SELECT COUNT(UserID) AS user_number FROM user WHERE Gender = 'Unknown' | 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 times more for the number of users who took the "mental health survey for 2017" than "mental health survey for 2018"? | How many times more = subtract(count(UserID(SurveyID = 2017)), count(UserID(SurveyID = 2018))) | SELECT CAST(COUNT(T1.UserID) AS REAL) / ( SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2018' ) FROM Answer AS T1 INNER JOIN Survey AS T2 ON T1.SurveyID = T2.SurveyID WHERE T2.Description = 'mental health survey for 2017' | 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 with the category are open from Monday to Thursday? | open from Monday to Thursday refers to day_of_week BETWEEN Monday AND Thursday and day_id BETWEEN 2 AND 5; | 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 INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id INNER JOIN Days AS T5 ON T4.day_id = T5.day_id WHERE T5.day_of_week L... | 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 ... |
world_development_indicators | What is the agricultural land area in sq. km of Italy in 1968? | agricultural land area in sq. km refers value where indicatorname = 'Agricultural land (sq. km)'; Italy refers to countryname = 'Italy'; in 1968 refers to year = '1968' | SELECT Value FROM Indicators WHERE IndicatorName = 'Agricultural land (sq. km)' AND Year = 1968 AND CountryName = 'Italy' | 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 | How many tweets are posted by male users in Argentina? | "Argentina" is the Country; male user refers to Gender = 'Male' | SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T1.UserID = T3.UserID WHERE T3.Gender = 'Male' AND T2.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 is the average number of respondents per survey between 2014 and 2019? | respondents and 'users' are synonyms; average number = avg(count(userID(SurveyID = 2014)), count(userID(SurveyID = 2019))) | SELECT CAST(COUNT(SurveyID) AS REAL) / 5 FROM Answer WHERE SurveyID BETWEEN 2014 AND 2019 | 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 businesses name with a rating less than 5 whose category name is men's clothing. | businesses name refers to business_id; rating refers to stars; stars < 5; | SELECT 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 T1.category_name LIKE 'Men''s Clothing' AND T3.stars < 5 | 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 ... |
professional_basketball | Who is the longest serving coach from year 1970 to 1980. List the coach ID and the team(s) he served. | 1970 to 1980 refers to year between 1970 and 1980; longest serving coach Max(Count(coachID)); team(s) he served refers to tmID | SELECT coachID, tmID FROM coaches WHERE year BETWEEN 1970 AND 1980 ORDER BY stint DESC LIMIT 1 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
social_media | Among all the tweets with a positive sentiment, what is the percentage of those posted by a male user? | positive sentiment refers to Sentiment > 0; male user refers to Gender = 'Male'; percentage = Divide (Count(TweetID where Gender = 'Male'), Count (TweetID)) * 100 | SELECT SUM(CASE WHEN T2.Gender = 'Male' THEN 1.0 ELSE 0 END) / COUNT(T1.TweetID) AS per FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Sentiment > 0 | 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, -- ... |
professional_basketball | For team who has more home won than home lost more than 80%, list the team name and the offense points. | home won than home lost more than 80% refers to Divide(Subtract(homeWon, homeLost), games) > 0.8; offense point refers to o_fgm | SELECT name, o_pts FROM teams WHERE CAST((homeWon - homeLost) AS REAL) * 100 / games > 80 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
trains | Among the trains running east, how many trains have at least 4 cars? | east is a direction; at least 4 cars refers to carsNum > = 4 | SELECT SUM(CASE WHEN T1.direction = 'east' THEN 1 ELSE 0 END)as count FROM trains AS T1 INNER JOIN ( SELECT train_id, COUNT(id) AS carsNum FROM cars GROUP BY train_id ) AS T2 ON T1.id = T2.train_id WHERE T2.carsNum >= 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 | What was the percentage for the answer of "Yes" was given to the question "Has your employer ever formally discussed mental health (for example, as part of a wellness campaign or other official communication)?"? | percentage = divide(count(QuestionID = 15& AnswerText = 'Yes'), count(QuestionID = 15))*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.questiontext LIKE 'Has your employer ever formally discussed mental health (for example, as part of a wellness campaign or other ... | 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 | Indicate the opening hours of businesses are with category in fashion. | opening hours refers to opening_time; category refers to category_name; | SELECT T4.opening_time 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 T1.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 ... |
social_media | What is the code of Gwynedd State? | code refers to StateCode | SELECT DISTINCT StateCode FROM location WHERE State = 'Gwynedd' | 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 respondents younger than 25 years old did participate in the survey in 2016? | respondents' and 'users' are synonyms; younger than 25 years old refers to AnswerText(SurveyID = 2016& QuestionID = 1)< 25 | SELECT COUNT(DISTINCT T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.QuestionID = 1 AND T1.SurveyID = 2016 AND T1.AnswerText <= 25 | 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 operating in the shopping business have opening times before 8AM? | shopping business refers to category_name = 'Shopping'; opening time before 8AM refers to opening_time < '8AM'; | SELECT COUNT(T3.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 INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T4.opening_time < '8AM' AND T1.category_name LIKE 'Shopping' | 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 ... |
professional_basketball | List all the coaches with more game lost than won from year 2000-2010. List the coach ID, team name and year. | from year 2000 to 2010 refers to year between 2000 and 2010; more game lost then won refers to lost > won | SELECT DISTINCT T1.coachID, T2.tmID, T1.year FROM coaches AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year BETWEEN 2000 AND 2010 AND T2.lost > T2.won | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
social_media | What is the average number of tweets posted by the users in a city in Argentina? | "Argentina" is the Country; average number of tweets in a city = Divide (Count(TweetID where Country = 'Argentina'), Count (City)) | SELECT SUM(CASE WHEN T2.City = 'Buenos Aires' THEN 1.0 ELSE 0 END) / COUNT(T1.TweetID) AS avg FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.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, -- ... |
professional_basketball | Who is the coach for 'BOS' team in year 1950. List the coach ID together with the number of game won and lost. | 'BOS' is the tmID; 1950 refers to year = 1950; number of game won refers to won; number of game lost refers to lost | SELECT coachID, won, lost FROM coaches WHERE year = 1950 AND tmID = 'BOS' | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
world_development_indicators | What is the lending category of the country with a cereal production of 6140000 metric tons for the year 1966? | cereal production of 6140000 metric tons refers value where IndicatorName = 'Cereal production (metric tons)'> 6140000; the year 1966 refers to Year = '1966' | SELECT T1.LendingCategory FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IndicatorName = 'Cereal production (metric tons)' AND T2.Value = 6140000 AND T2.Year = 1966 | 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 | For the tweet which got a reach number of 547851, which country did it come from? | reach number of 547851 refers to Reach = 547851 | SELECT T2.Country FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.Reach = 547851 | 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 | How many students have never been absent in school? | never been absent in school refers to month = 0; | SELECT COUNT(name) FROM longest_absense_from_school WHERE month = 0 | 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 | For all the Yelp businesses that allow customers bring their own beer, what percentage of them are in "Phoenix"? | bring their own beer refers to attribute_name = 'BYOB' AND attribute_value = 'TRUE'; Phoenix refers to city = 'Phoenix'; percentage = MULTIPLY(DIVIDE(SUM(city = 'Phoenix'), COUNT(business_id)), 1.0) | SELECT CAST(SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.business_id) AS "percentage" FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name LIKE 'BYOB' AND ... | 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 Scottish League One games took place on the day that "Pro Vercelli" and "Pescara"had a 5-2 game? | Pro Vercelli and Pescara are names of teams; HomeTeam = 'Pro Vercelli'; AwayTeam = 'Pescara'; 5-2 is a score where FTHG = '5' and FTAG = '2'; Scottish League One is a name of division; games refer to Div; | SELECT COUNT(T1.Date) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Scottish League One' AND T1.Date = ( SELECT Date FROM matchs WHERE FTHG = 5 AND FTAG = 2 AND HomeTeam = 'Pro Vercelli' AND AwayTeam = 'Pescara' ) | 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 | State the number of states in the United Kingdom. | "United Kingdom" is the Country | SELECT COUNT(State) AS State_number FROM location WHERE Country = 'United Kingdom' | 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 user ids from 1 to 20 have no fan users and have low ratings? | user_id BETWEEN 1 AND 20; no fan users refers to user_fans = 'None'; low ratings refers to user_review_count = 'Low'; | SELECT COUNT(user_id) FROM Users WHERE user_id BETWEEN 1 AND 20 AND user_fans LIKE 'None' AND user_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 ... |
world_development_indicators | What are the indicator codes for the Republic of Albania in the year 1960? | the Republic of Albania refers to LongName = 'Republic of Albania'; in the year 1960 refers to Year = '1960' | SELECT DISTINCT T1.IndicatorCode FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Year = 1960 AND T2.LongName = 'Republic of Albania' | 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 | How many reshared tweets are there in Texas? | reshared tweet refers to IsReshare = 'TRUE'; 'Texas' is the State | SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.State = 'Texas' 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, -- ... |
student_loan | How many male students are enrolled at OCC? | male students are mentioned in male.name; OCC refers to school = 'occ'; | SELECT COUNT(T1.name) FROM enrolled AS T1 INNER JOIN male AS T2 ON T1.name = T2.name WHERE T1.school = 'occ' | 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 ... |
professional_basketball | What is the birth date of the player with the most assists during the 1985 All-Star season? | most assist refers to Max(assists); in 1985 All Star season refers to season_id = 1985 | SELECT T1.birthDate FROM players AS T1 INNER JOIN player_allstar AS T2 ON T1.playerID = T2.playerID WHERE T2.season_id = 1985 ORDER BY T2.assists DESC LIMIT 1 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
trains | How many eastbound trains have rectangular-shaped head cars? | eastbound refers to direction = 'east'; head cars refers to position = 1 | SELECT COUNT(T.train_id) FROM (SELECT T1.train_id FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.position = 1 AND T2.direction = 'east' AND T1.shape = 'rectangle' GROUP BY T1.train_id)as T | 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 respondents who participated in the survey in 2019 have ever sought treatment for a mental health disorder from a mental health professional? | respondents' and 'users' are synonyms, have ever sought treatment for a mental health disorder from a mental health professional refers to AnswerText(SurveyID = 2019& QuestionID = 7) = 1 | SELECT COUNT(T1.UserID) FROM Answer AS T1 INNER JOIN Question AS T2 ON T1.QuestionID = T2.questionid WHERE T1.QuestionID = 7 AND T1.SurveyID = 2019 AND T1.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 active businesses of city are underrated? | active businesses refers to active = 'true'; underrated refers to review_count = 'Low'; | SELECT COUNT(business_id) FROM Business WHERE review_count LIKE 'Low' 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 ... |
professional_basketball | What is the percentage of player who won "All-Defensive First Team" from 1980 - 2000 is from 'NY'. | "All-Defensive First Team" is the award; ' NY' is the birthState; 1980 to 2000 refers to year between 1980 and 2000; percentage = Divide (Count(playerID where birthState = 'NY'), Count(playerID)) * 100 | SELECT COUNT(DISTINCT T1.playerID) FROM players AS T1 INNER JOIN awards_players AS T2 ON T1.playerID = T2.playerID WHERE T1.birthState = 'NY' AND T2.award = 'All-Defensive First Team' AND T2.year BETWEEN 1980 AND 2000 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
world_development_indicators | Which country has the highest population in largest city for 19 consecutive years starting from 1960? Indicate the region to which the country is located. | the highest population in largest city refers to max(value where IndicatorName = 'Population in largest city'); for 19 consecutive years starting from 1960 refers to Year BETWEEN'1960' and '1979' | SELECT T2.CountryCode, T2.Region FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IndicatorName = 'Population in largest city' AND T1.Year >= 1960 AND T1.Year < 1980 ORDER BY T2.Region DESC LIMIT 1 | 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 | How many wheels do the long cars have? | long cars refers to len = 'long' | SELECT SUM(wheels) FROM cars WHERE len = 'long' | 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 | Among the students enrolled in UCLA, what is the percentage of male students in the air force department? | UCLA refers to school = 'ucla'; percentage = MULTIPLY(DIVIDE(COUNT(male.name), COUNT(person.name)), 100); male students are mentioned in male.name; department refers to organ; organ = 'air_force'; | SELECT CAST(COUNT(T4.name) AS REAL) * 100 / COUNT(T2.name) FROM enlist AS T1 INNER JOIN person AS T2 ON T1.name = T2.name INNER JOIN enrolled AS T3 ON T3.name = T2.name LEFT JOIN male AS T4 ON T2.name = T4.name WHERE T3.school = 'ucla' AND T1.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 ... |
professional_basketball | In what year did the only team to beat the Houston in the final round of postseason series games earn its lowest ranking? | beat the Huston refers to tmIDLoser = 'HSM'; in final round of post season refers to round = 'DSF' | SELECT T2.year FROM series_post AS T1 INNER JOIN teams AS T2 ON T1.tmIDWinner = T2.tmID WHERE T1.round = 'DSF' AND T1.tmIDLoser = 'HSM' ORDER BY T2.rank ASC LIMIT 1 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
world_development_indicators | Which country has the smallest land area in square kilometers for 19 consecutive years starting from year 1961? Indicate how much is its land area in square kilometers in those years and the income group of the country. | the smallest land area in square kilometers refers to min(value where IndicatorName like 'Land area (sq. km)'); for 19 consecutive years starting from year 1961 refers to Year between 1961 and 1979 | SELECT T1.CountryName, SUM(T1.Value) area, T2.IncomeGroup FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IndicatorName = 'Land area (sq. km)' AND T1.Year >= 1961 AND T1.Year < 1980 GROUP BY T1.CountryCode ORDER BY SUM(T1.Value) ASC LIMIT 1 | 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 | Show the text of the tweet with the highest klout from Connecticut. | highest klout refers to Max(Klout); 'Connecticut' is the State | SELECT T1.text FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T2.State = 'Connecticut' ORDER BY T1.Klout 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, -- ... |
world_development_indicators | What's the lastest household survey in Angola and when did it take place? | in Angola refers to ShortName = 'Angola'; when refers to PppSurveyYear | SELECT LatestHouseholdSurvey, PppSurveyYear FROM Country WHERE ShortName = 'Angola' | 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 | Give the location id of West Sussex State. | null | SELECT DISTINCT LocationID FROM location WHERE State = 'West Sussex' | 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 | Which organization has the least number of male students? | organization refers to organ; male students are mentioned in male.name; least number of male students refers to MIN(male.name); | SELECT T.organ FROM ( SELECT T2.organ, COUNT(T1.name) AS num FROM male AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name GROUP BY T2.organ ) T ORDER BY T.num 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 | User No. 70271 only has given one tip to the Yelp business, which category was that business belonged to? | user No. refers to user_id; short tip refers to tip_length = 'short'; category refers to category_name; | SELECT T4.category_name FROM Tips AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T1.user_id = 70271 | 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 gender of the user who tweeted `tw-715909161071091712`? | "tw-715909161071091712" is the TweetID | SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.TweetID = 'tw-715909161071091712' | 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, -- ... |
professional_basketball | In year 2000, who are the coaches with more than 50 games won. List the coachID, team name and number of game won at home game. | more than 50 games won refers to won > 50 | SELECT T1.coachID, T2.name, T2.won FROM coaches AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID AND T1.year = T2.year WHERE T1.year = 2000 AND T2.won > 50 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
world_development_indicators | What is the average number of passengers carried via air transport per year by Bulgaria between 1970 to 1980? Indicate the country's system of trade. | average number refers to avg(value); passengers carried via air transport per year refers to value where IndicatorName = 'Air transport, passengers carried'; by Bulgaria refers to CountryName = 'Bulgaria'; between 1970 to 1980 refers to Year between 1970 and 1980 | SELECT AVG(T1.Value), T2.SystemOfTrade FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IndicatorName = 'Air transport, passengers carried' AND T1.Year >= 1970 AND T1.Year < 1981 AND T1.CountryName = 'Bulgaria' | 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 | State the number of positive tweets from Ha Noi. | positive tweet refers to Sentiment > 0; 'Ha Noi' is the State | SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.Sentiment > 0 AND T2.State = 'Ha Noi' | 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 | Give the number of "drive-thru" businesses in "Scottsdale" with business ID number less than "1000". | drive-thru refers to attribute_name = 'Drive-Thru' AND attribute_value = 'true'; Scottsdale refers to city = 'Scottsdale'; business_id < 1000; | SELECT T2.business_id FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.business_id < 1000 AND T3.city LIKE 'Scottsdale' AND T1.attribute_name LIKE 'Drive-Thru' AND T2.attribute_value 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 ... |
world_development_indicators | In which years does the country whose Alpha2Code is 1A have a result of the indicator Adolescent fertility rate? | indicator Adolescent fertility rate refers to IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)'
| SELECT T2.Year 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)' | 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 | Give the gender of the user who made the highest klout tweet on Wednesdays. | highest klout refers to Max(Klout); 'Wednesday' is the Weekday | SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.Weekday = 'Wednesday' ORDER BY T1.Klout 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 types of music does Yelp business No."1141" have? | types of music refers to attribute_name LIKE '%music%' WHERE attribute_value = 'true'; business No. refers to business_id;
| SELECT COUNT(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 = 1141 | 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 | What is the average household income of Glendale? | "Glendale" is the City Name; Average household income refers to avg(Household Income) | SELECT AVG(`Household Income`) FROM `Store Locations` WHERE `City Name` = 'Glendale' | 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... |
world_development_indicators | What's the long name of the country that got 3000000 on the indicator Arms exports in 1960? | long name refers to CountryName; got 3000000 on the indicator Arms exports refers to value where IndicatorName = 'Arms exports (SIPRI trend indicator values)' = 3000000; in 1960 refers to Year = 1960 | SELECT T1.LongName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IndicatorName = 'Arms exports (SIPRI trend indicator values)' AND T2.Year = 1960 AND T2.Value = 3000000 | 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 | How many female Twitter users are there from Wisconsin? | female users refers to Gender = 'Female'; 'Wisconsin' is the State | SELECT COUNT(T1.Likes) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T3.UserID = T1.UserID WHERE T2.State = 'Wisconsin' AND T3.Gender = 'Female' | 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, -- ... |
professional_basketball | What is the nickname of the NBA player whose team competed in the Western Conference in the season 2006 and who had a total of two blocks? | completed in the Western conference refers to conference = 'West'; in season 2006 refers to season_id = 2006; total of two blocks refers to blocks = 2; nickname refers to nameNick | SELECT T2.nameNick FROM player_allstar AS T1 INNER JOIN players AS T2 ON T1.playerID = T2.playerID WHERE T1.blocks = 2 AND T1.conference = 'West' AND T1.season_id = 2006 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
world_development_indicators | How many countries in the North America Region has completed the vital registration? | has completed the vital registration refers to VitalRegistrationComplete = 'Yes' | SELECT COUNT(CountryCode) FROM Country WHERE VitalRegistrationComplete = 'Yes' AND Region = 'North America' | 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 | What is the gender of the user whose tweet got 535 retweets? | tweet got 535 retweets refers to RetweetCount = 535 | SELECT T2.Gender FROM twitter AS T1 INNER JOIN user AS T2 ON T1.UserID = T2.UserID WHERE T1.RetweetCount = 535 | 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 | What is the average rating for the all Yelp businesses that open 24 hours? | open 24 hours refers to attribute_name = 'Open 24 Hours' AND attribute_value = 'true'; rating refers to stars; average rating = AVG(stars); | SELECT CAST(SUM(T3.stars) AS REAL) / COUNT(T2.business_id) AS "avg" FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name LIKE 'Open 24 Hours' AND T2.attribute_value 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 ... |
professional_basketball | Which team(s) had 90% games won. List the coach ID for the team and year played. | team with 90% games won refers to Divide (won, games) > 0.9 | SELECT DISTINCT T2.name, T1.year, T1.coachID FROM coaches AS T1 INNER JOIN teams AS T2 ON T1.tmID = T2.tmID WHERE CAST(T2.won AS REAL) * 100 / T2.games > 90 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
trains | How many trains running west have double sided cars in 3rd position? | west is a direction; double sided cars refers to sides = 'double'; 3rd position refers to position = 3 | SELECT COUNT(T.train_id) FROM (SELECT T1.train_id FROM cars AS T1 INNER JOIN trains AS T2 ON T1.train_id = T2.id WHERE T1.position = 3 AND T2.direction = 'west' AND T1.sides = 'double' GROUP BY T1.train_id)as T | 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... |
world_development_indicators | Please list the Alpha2Codes of all the countries that have an indicator on Rural population in 1960. | in 1960 refers to year = '1960' | SELECT T1.Alpha2Code FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IndicatorName = 'Rural population' AND T2.Year = 1960 | 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 | State the number of tweets from Michigan on Thursdays. | "Michigan" is the State; 'Thursday' is the Weekday; number of tweets refers to Count(TweetID) | SELECT COUNT(T1.TweetID) FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.Weekday = 'Thursday' AND T2.State = 'Michigan' | 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 "cute" type of compliments does user No. 57400 get? | type of compliments refers to compliment_type; user No. refers to user_id; | SELECT COUNT(T1.compliment_type) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type LIKE 'cute' AND T2.user_id = 57400 | 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 ... |
professional_basketball | What division did the team coached by the winner of the 1977 NBA Coach of the Year award play in in 1976? | "NBA Coach of the Year" is the award; in 1977 refers to year = 1977; in 1976 refers to year = 1976; division refers to divisionID | SELECT DISTINCT T3.divID FROM awards_coaches AS T1 INNER JOIN coaches AS T2 ON T1.coachID = T2.coachID INNER JOIN teams AS T3 ON T2.tmID = T3.tmID WHERE T1.year = 1977 AND T1.award = 'NBA Coach of the Year' AND T3.year = 1976 | CREATE TABLE players_teams
(
PostGS INTEGER, --
PostdRebounds INTEGER, --
PostPF INTEGER, --
tmID TEXT, --
threeAttempted INTEGER, --
PostRebounds INTEGER, --
assists INTEGER, --
threeMade INTEGER, --
PostBlocks INTEGER, --
PostTurnovers INTEGER, --
GP INTEGER, --
lgID TEXT, -- Example... |
world_development_indicators | What is the series code for number of infant deaths in year 1965 for the country whose full name is Islamic State of Afghanistan? | number of infant deaths refers to IndicatorName = 'Number of infant deaths'; in year 1965 refers to Year = '1965'; full name is Islamic State of Afghanistan refers to LongName = 'Islamic State of Afghanistan' | SELECT DISTINCT T3.Seriescode FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode INNER JOIN CountryNotes AS T3 ON T2.CountryCode = T3.Countrycode WHERE T2.IndicatorName = 'Number of infant deaths' AND T1.LongName = 'Islamic State of Afghanistan' AND T2.Year = 1965 | 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 | Give the name of the city of the user who tweeted `One of our favorite stories is @FINRA_News's move to the cloud with AWS Enterprise Support! https://amp.twimg.com/v/991837f1-4815-4edc-a88f-e68ded09a02a`. | "One of our favorite stories is @FINRA_News's move to the cloud with AWS Enterprise Support! https://amp.twimg.com/v/991837f1-4815-4edc-a88f-e68ded09a02a" is the text | SELECT T2.City FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID WHERE T1.text = 'One of our favorite stories is @FINRA_News''s move to the cloud with AWS Enterprise Support! https://amp.twimg.com/v/991837f1-4815-4edc-a88f-e68ded09a02a' | 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, -- ... |
world_development_indicators | Among the countries who uses the 1968 System of National Accounts methodology, how many are in the Middle East & North Africa? Name the country with the highest CO2 emissions from solid fuel consumption in kiloton. | uses the 1968 System of National Accounts methodology refers to SystemOfNationalAccounts = '1968 System of National Accounts methodology'; in the Middle East & North Africa refers to Region = 'Middle East & North Africa'; the highest CO2 emissions from solid fuel consumption in kiloton refers to max(value where Indicat... | SELECT COUNT(DISTINCT T1.CountryCode) FROM indicators AS T1 INNER JOIN country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Region = 'Middle East & North Africa' AND T2.SystemOfNationalAccounts = 'Country uses the 1968 System of National Accounts methodology.' AND T1.IndicatorName = 'CO2 emissions FROM solid fuel ... | 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 | What is the percentage of male Twitter users from Florida? | "Florida" is the State; male user refers to Gender = 'Male'; percentage = Divide (Count(UserID where Gender = 'Male'), Count (UserID)) * 100 | SELECT SUM(CASE WHEN T3.Gender = 'Male' THEN 1.0 ELSE 0 END) / COUNT(T1.TweetID) AS percentage FROM twitter AS T1 INNER JOIN location AS T2 ON T2.LocationID = T1.LocationID INNER JOIN user AS T3 ON T3.UserID = T1.UserID WHERE T2.State = 'Florida' | 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, -- ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.