db_id
stringclasses
68 values
question
stringlengths
24
325
evidence
stringlengths
0
580
SQL
stringlengths
23
728
movielens
Please list movie IDs which has the oldest publication date and the cast numbers are zero.
Year contains relative value, higher year value refers to newer date; Year = 1 refer to oldest date
SELECT DISTINCT T1.movieid FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.year = 1 AND T2.cast_num = 0
movielens
How many actors have acted in both US or UK films?
US and UK are 2 countries
SELECT COUNT(T1.actorid) FROM movies2actors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'USA' OR T2.country = 'UK'
movielens
How many directors with average revenue of 4 have made either action or adventure films?
SELECT COUNT(T1.directorid) FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.avg_revenue = 4 AND (T2.genre = 'Adventure' OR T2.genre = 'Action')
movielens
Please list director IDs who have the quality of at least 3 and have made at least 2 different genres of movies.
SELECT T1.directorid FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality >= 3 GROUP BY T1.directorid HAVING COUNT(T2.movieid) >= 2
movielens
How many American comedies are there?
USA is a country
SELECT COUNT(T1.movieid) FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'USA' AND T2.genre = 'comedy'
movielens
How many latest released dramas and action movies?
SELECT COUNT(T1.movieid) FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.year = 4 AND T1.genre IN ('Action', 'drama')
movielens
What horror movies have a running time of at least 2? Please list movie IDs.
Higher value of running time means running time is longer
SELECT T1.movieid FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.runningtime >= 2 AND T1.genre = 'Horror'
movielens
What's different average revenue status for director who directed the movie that got the most 1 ratings?
SELECT DISTINCT T1.avg_revenue FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 5
movielens
How many French movies got the highest ranking?
France is a country
SELECT COUNT(movieid) FROM movies WHERE country = 'France' AND movieid IN ( SELECT movieid FROM u2base WHERE rating = ( SELECT MAX(rating) FROM u2base ) )
movielens
How many female actors have been played a role in any of French or USA movies?
French and USA are two countries; Female actors mean that a_gender = 'F'
SELECT COUNT(T2.actorid) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.country IN ('France', 'USA')
movielens
How many unique directors with an average earnings of 2 and a quality of 3 have not made comedy films? List them.
SELECT DISTINCT T1.directorid FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 3 AND T1.avg_revenue = 2 AND T2.genre != 'Comedy'
movielens
Which actor has appeared in the most films?
SELECT actorid FROM movies2actors GROUP BY actorid ORDER BY COUNT(movieid) DESC LIMIT 1
movielens
What is the most popular genre of film directed by directors?
Most popular genre indicates that the genre has the most number of movies
SELECT genre FROM movies2directors GROUP BY genre ORDER BY COUNT(movieid) DESC LIMIT 1
movielens
What are the most common film genres made by the worst directors?
d_quality = 5 refers to the best directors, d_quality = 0 refers to the worst directors
SELECT T2.genre FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 0 GROUP BY T2.genre ORDER BY COUNT(T2.movieid) DESC LIMIT 1
movielens
What non-English American film/s has received the lowest user ratings? Mention the movie's I.D.
USA is a country; non-English means isEnglish = 'F'
SELECT T2.movieid FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid WHERE T1.isEnglish = 'F' AND T1.country = 'USA' ORDER BY T2.rating LIMIT 1
movielens
What is the total average movie directed by the directors who's quality and revenue is 4?
SELECT CAST(SUM(CASE WHEN T1.d_quality = 4 AND T1.avg_revenue = 4 THEN 1 ELSE 0 END) AS REAL) / COUNT(T2.movieid) FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid
movielens
How many horror movies were made by the worst directors?
d_quality = 5 refers to direct the best, d_quality = 0 refers to direct the worst
SELECT COUNT(T1.movieid) FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid INNER JOIN directors AS T3 ON T1.directorid = T3.directorid WHERE T1.genre = 'horror' AND T3.d_quality = 0
movielens
What are the genres of all the English-language foreign films having a runtime of two hours or less? List each one.
isEnglish = 'T' means films in English; Film and movie share the same meaning
SELECT T2.genre FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.runningtime <= 2 AND T1.isEnglish = 'T' AND T1.country = 'other'
superstore
What is the ratio between customers who live in Texas and customers who live in Indiana?
live in Texas refers to State = 'Texas'; live in Indiana refers to State = 'Indiana'; Ratio = divide(sum(State = 'Texas'), sum(State = 'Indiana'))
SELECT CAST(SUM(CASE WHEN State = 'Texas' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN State = 'Indiana' THEN 1 ELSE 0 END) FROM people
shooting
Which are the cases where the subject are female. List the case number, subject status and weapon.
female refers to gender = 'F'; weapon refers to subject_weapon
SELECT T1.case_number, T1.subject_statuses, T1.subject_weapon FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T2.gender = 'F'
shooting
From the cases where the subject are male, list the case number and the location and subject status.
male refers to gender = 'M'
SELECT T1.case_number, T1.location, T1.subject_statuses FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T2.gender = 'M'
shooting
For case number '134472-2015', list the last name of the officers involved and state the subject statuses.
SELECT T2.last_name, T1.subject_statuses FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number WHERE T1.case_number = '134472-2015'
shooting
From the cases where the subject were deceased, list the subject's last name, gender, race and case number.
subject were deceased refers to subject_statuses = 'Deceased'
SELECT T2.last_name, T2.gender, T2.race, T2.case_number FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T1.subject_statuses = 'Deceased'
shooting
How many incidents in which the subject's weapon was a vehicle were investigated by a female officer?
subject's weapon was a vehicle refers to subject_weapon = 'Vehicle'; female refers to gender = 'F'
SELECT COUNT(T1.case_number) FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number WHERE T1.subject_weapon = 'Vehicle' AND T2.gender = 'F'
shooting
In how many cases where the subject was a female was the subject's status listed as Deceased?
female refers to gender = 'F'; subject's status listed as Deceased refers to subject_statuses = 'Deceased'
SELECT COUNT(T1.case_number) FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T2.gender = 'F' AND T1.subject_statuses = 'Deceased'
shooting
Of the black officers, how many of them investigated cases between the years 2010 and 2015?
black refers to race = 'B'; between the years 2010 and 2015 refers to date between '2010-01-01' and '2015-12-31'; case refers to case_number
SELECT COUNT(T1.case_number) FROM officers AS T1 INNER JOIN incidents AS T2 ON T2.case_number = T1.case_number WHERE T1.race = 'B' AND T2.date BETWEEN '2010-01-01' AND '2015-12-31'
shooting
How many instances were found in June 2015?
in June 2015 refers to date between '2015-06-01' and '2015-06-30'; record number refers to case_number
SELECT COUNT(case_number) FROM incidents WHERE date BETWEEN '2015-06-01' AND '2015-06-30'
shooting
How many people were injured between 2006 and 2014 as a result of a handgun?
injured refers to subject_statuses = 'injured'; between 2006 and 2014 refers to date between '2006-01-01' and '2013-12-31'; handgun refers to subject_weapon = 'handgun'; where the incidents took place refers to location
SELECT COUNT(location) FROM incidents WHERE subject_weapon = 'Handgun' AND subject_statuses = 'Injured' AND date BETWEEN '2006-01-01' AND '2013-12-31'
shooting
What is the most common type of weapon that causes death?
the most common type of weapon refers to max(count(subject_weapon)); causes death refers to subject_statuses = 'Deceased'
SELECT subject_weapon FROM incidents WHERE subject_statuses = 'Deceased' GROUP BY subject_weapon ORDER BY COUNT(case_number) DESC LIMIT 1
shooting
Which type of weapon was used to attack the victim in the record number 031347-2015? What is the victim's race and gender?
type of weapon refers to subject_weapon; record number 031347-2015 refers to case_number = '031347-2015'
SELECT T1.subject_weapon, T2.race, T2.gender FROM incidents AS T1 INNER JOIN subjects AS T2 ON T1.case_number = T2.case_number WHERE T1.case_number = '031347-2015'
shooting
Which near-death incident did a policeman by the name of Ruben Fredirick look into? What is the victim in this incident's race and gender?
near-death refers to subject_statuses = 'Deceased Injured'; incident refers to case_number; Ruben Fredirick refers to full_name = 'Ruben Fredirick'
SELECT T1.case_number, T3.race, T3.gender FROM incidents AS T1 INNER JOIN officers AS T2 ON T1.case_number = T2.case_number INNER JOIN subjects AS T3 ON T1.case_number = T3.case_number WHERE T2.first_name = 'Fredirick' AND T2.last_name = 'Ruben'
genes
For the genes that are located in the plasma membrane, please list their number of chromosomes.
SELECT T1.Chromosome FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'plasma membrane'
genes
How many non-essential genes are located in the nucleus?
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'nucleus' AND T1.Essential = 'Non-Essential'
genes
Among the genes with nucleic acid metabolism defects, how many of them can be found in the vacuole?
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID WHERE T2.Localization = 'vacuole' AND T1.Phenotype = 'Nucleic acid metabolism defects'
genes
Please list the location of the genes that have the most chromosomes.
SELECT T2.Localization FROM Genes AS T1 INNER JOIN Classification AS T2 ON T1.GeneID = T2.GeneID ORDER BY T1.Chromosome DESC LIMIT 1
genes
Among the pairs of genes that are both located in the nucleus, what is the highest expression correlation score?
SELECT T2.Expression_Corr FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 INNER JOIN Genes AS T3 ON T3.GeneID = T2.GeneID2 WHERE T1.Localization = 'nucleus' AND T3.Localization = 'nucleus' ORDER BY T2.Expression_Corr DESC LIMIT 1
genes
What are the functions of the pair of genes that have the lowest expression correlation score?a
SELECT T1.Function FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 ORDER BY T2.Expression_Corr ASC LIMIT 1
genes
Among the pairs of genes that are not from the class of motorproteins, how many of them are negatively correlated?
If Expression_Corr < 0, it means the negatively correlated
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 AND T1.Class = 'Motorproteins'
genes
For the pairs of genes with one having 8 chromosomes and the other having 6 chromosomes, what is the highest expression correlation score?
SELECT T2.Expression_Corr FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Chromosome = 6 OR T1.Chromosome = 8 ORDER BY T2.Expression_Corr DESC LIMIT 1
genes
Please list the motif of the genes that are located in the cytoplasm and have 7 chromosomes.
SELECT T2.GeneID1, T2.GeneID2 FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization = 'cytoplasm' AND T1.Chromosome = 7
genes
For the non-essential genes whose functions are transcription, how many of them are not located in the cytoplasm?
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization != 'cytoplasm' AND T1.Function = 'TRANSCRIPTION' AND T1.Essential = 'NON-Essential'
genes
How many pairs of positively correlated genes are both non-essential?
If Expression_Corr > 0, it means the expression correlation is positive
SELECT COUNT(T2.GeneID2) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr > 0 AND T1.Essential = 'Non-Essential'
genes
For the pairs of genes both from the class ATPases, what is the average expression correlation score?
SELECT AVG(T2.Expression_Corr) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Class = 'ATPases'
genes
Lists all genes by identifier number located in the cytoplasm and whose function is metabolism.
SELECT DISTINCT GeneID FROM Genes WHERE Localization = 'cytoplasm' AND Function = 'METABOLISM'
genes
How many different genes do we have if we add those located in the plasma and in the nucleus?
SELECT COUNT(GeneID) FROM Classification WHERE Localization IN ('plasma', 'nucleus')
genes
What type of interactions occurs in genes whose function is cellular transport and transport medicine and are classified as non-essential?
SELECT T2.Type FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Function = 'TRANSCRIPTION' AND T1.Essential = 'Non-Essential'
genes
List all genes whose interaction is with genes located in the nucleus in which it is positively correlated.
If the Expression_Corr value is positive then it's positively correlated
SELECT T1.GeneID FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr > 0 AND T1.Localization = 'nucleus'
genes
Taking all the essential genes of the transcription factors class located in the nucleus as a reference, how many of them carry out a genetic-type interaction with another gene? List them.
SELECT T2.GeneID1 FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T1.Localization = 'nucleus' AND T1.Class = 'Transcription factors' AND T1.Essential = 'Essential' AND T2.Expression_Corr != 0
genes
Of all the nonessential genes that are not of the motorprotein class and whose phenotype is cell cycle defects, how many do not have a physical type of interaction?
SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Type != 'Physical' AND T1.Phenotype = 'Cell cycle defects' AND T1.Class != 'Motorproteins' AND T1.Essential = 'Non-Essential'
genes
Which negatively correlated, genetically interacting genes are non-essential? What percentage do they represent with respect to those that are essential?
If the Expression_Corr value is negative then it's negatively correlated; Percentage of Essensity = [count(negatively correlated, genetical interaction, non-essential) / count(negatively correlated, genetical interaction, non-essential+negatively correlated, genetical interaction, essential)] * 100%
SELECT CAST(COUNT(T1.GeneID) AS REAL) * 100 / ( SELECT COUNT(T1.GeneID) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 ) FROM Genes AS T1 INNER JOIN Interactions AS T2 ON T1.GeneID = T2.GeneID1 WHERE T2.Expression_Corr < 0 AND T1.Essential = 'Non-Essential'
app_store
What is the name and category of the app with the highest amount of -1 sentiment polarity score?
highest amount of -1 sentiment polarity score refers to MAX(Count(Sentiment_Polarity = 1.0))
SELECT DISTINCT T1.App, T1.Category FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment_Polarity = '-1.0'
app_store
How many apps have rating of 5?
FALSE;
SELECT COUNT(App) FROM playstore WHERE Rating = 5
app_store
What is the average rating of comic category apps? How many users hold positive attitude towards this app?
average rating = AVG(Rating where Category = 'COMICS'); number of users who hold a positive attitude towards the app refers to SUM(Sentiment = 'Positive');
SELECT AVG(T1.Rating) , COUNT(CASE WHEN T2.Sentiment = 'Positive' THEN 1 ELSE NULL END) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Category = 'COMICS'
app_store
What is the rating for "Draw A Stickman"?
Draw A Stickman refers to App = 'Draw A Stickman';
SELECT Rating FROM playstore WHERE APP = 'Draw A Stickman'
app_store
How many of the reviews for the app "Brit + Co" have a comment?
Brit + Co refers to App = 'Brit + Co'; comment refers to Translated Review NOT null;
SELECT COUNT(App) FROM user_reviews WHERE App = 'Brit + Co' AND Translated_Review IS NOT NULL
app_store
How many neutral reviews does the app "Dino War: Rise of Beasts" have?
neutral reviews refers to Sentiment = 'Neutral';
SELECT COUNT(App) FROM user_reviews WHERE App = 'Dino War: Rise of Beasts' AND Sentiment = 'Neutral'
app_store
What are the apps with only 5,000+ installs?
Installs = '5,000+';
SELECT DISTINCT App FROM playstore WHERE Installs = '5,000+'
app_store
List all the negative comments on the "Dog Run - Pet Dog Simulator" app.
negative comment refers to Sentiment = 'Negative';
SELECT Translated_Review FROM user_reviews WHERE App = 'Dog Run - Pet Dog Simulator' AND Sentiment = 'Negative'
app_store
Which free app has the most Negative comments?
paid app refers to Type = 'Paid'; negative comment refers to Sentiment = 'Negative'; paid app with most negative comments refers to MAX(COUNT(Sentiment = 'Negative')) where Type = 'Paid';
SELECT T1.App FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Type = 'Free' AND T2.Sentiment = 'Negative' GROUP BY T1.App ORDER BY COUNT(T2.Sentiment) DESC LIMIT 1
app_store
How many negative comments are there in all the apps with 100,000,000+ installs?
negative comment refers to Sentiment = 'Negative'; Installs = '100,000,000+';
SELECT COUNT(T2.Sentiment) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Installs = '100,000,000+' AND T2.Sentiment = 'Negative'
app_store
What is the rating for "Garden Coloring Book"? List all of its reviews.
Golfshot Plus: Golf GPS refers to App = 'Golfshot Plus: Golf GPS'; review refers to Translated_Review;
SELECT T1.Rating, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Garden Coloring Book'
app_store
List all the comments on the lowest rated Mature 17+ app.
comments refers to Translated_Review; lowest rated refers to Rating = 1; Mature 17+ refers to Content Rating = 'Mature 17+ ';
SELECT T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1."Content Rating" = 'Mature 17+' ORDER BY T1.Rating LIMIT 1
app_store
What is the number of neutral comments from all the weather apps?
neutral comments refers to Sentiment = 'Neutral'; weather app refers to Genre = 'Weather';
SELECT COUNT(T2.Sentiment) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Genres = 'Weather' AND T2.Sentiment = 'Neutral'
app_store
Which 1,000,000,000+ intalls apps has the most no comment reviews?
no comment refers to Translated_Review = 'nan'; most no comment reviews = (MAX(COUNT(Translated_Review = 'nan')));
SELECT T1.App FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Installs = '1,000,000+' AND T2.Translated_Review = 'nan' GROUP BY T1.App ORDER BY COUNT(T2.Translated_Review) DESC LIMIT 1
app_store
Which apps have 5 rating? List out then application name.
application name refers to App;
SELECT DISTINCT App FROM playstore WHERE Rating = 5
app_store
List out genre that have downloads more than 1000000000.
downloads and installs are synonyms; Installs = '1,000,000,000+';
SELECT Genres FROM playstore WHERE Installs = '1,000,000,000+' GROUP BY Genres
app_store
What is the average review number for application with 5 rating?
average review = AVG(Review); application refers to app; Rating = 5;
SELECT AVG(Reviews) FROM playstore WHERE Rating = 5
app_store
What is the percentage for free application with a rating 4.5 and above have not been updated since 2018?
paid refers to Type = 'Paid'; application refers to App; Rating>4.5; Last Updated>'2018; percentage = DIVIDE(SUM(Genres = 'Mature 17+' and Rating>4.5 and substr("Last Updated",-4,4)>'2018' )), (COUNT(App)) as percent;
SELECT CAST(SUM(CASE WHEN SUBSTR('Last Updated', -4) > '2018' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(App) PER FROM playstore WHERE Type = 'Free' AND Rating >= 4.5
app_store
What genre does Honkai Impact 3rd belong to?
Honkai Impact 3rd is the App;
SELECT DISTINCT Genres FROM playstore WHERE App = 'Honkai Impact 3rd'
app_store
List down the rating for the App Learn C++.
FALSE;
SELECT DISTINCT Rating FROM playstore WHERE App = 'Learn C++'
app_store
List all free sports Apps and their translated review.
paid sports Apps refers to type = 'Paid' and Category = 'SPORTS';
SELECT T1.App, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Type = 'Free' AND T1.Category = 'SPORTS'
app_store
What is the average rating of Apps falling under the racing genre and what is the percentage ratio of positive sentiment reviews?
average rating = AVG(Rating); percentage = MULTIPLY(DIVIDE((SUM(Sentiment = 'Positive')), (COUNT(*)), 100));
SELECT AVG(T1.Rating), CAST(COUNT(CASE WHEN T2.Sentiment = 'Positive' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.Sentiment) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Genres = 'Racing'
regional_sales
How many states located in the Midwest region?
SELECT COUNT(DISTINCT T) FROM ( SELECT CASE WHEN Region = 'Midwest' THEN StateCode ELSE NULL END AS T FROM Regions ) WHERE T IS NOT NULL
regional_sales
How many states are in the Midwest region?
SELECT COUNT(DISTINCT T) FROM ( SELECT CASE WHEN Region = 'Midwest' THEN State ELSE NULL END AS T FROM Regions ) WHERE T IS NOT NULL
european_football_1
What is the most consecutive games tied by Ebbsfleet as an away team in the 2008 season?
consecutive games mean happen one after the other without interruption and refer to Date; tied refers to FTR = 'D';
SELECT COUNT(*) FROM matchs WHERE season = 2008 AND AwayTeam = 'Ebbsfleet' AND FTR = 'D'
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
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 = 'D'where HomeTeam = 'Cittadella'), COUNT(Div where HomeTeam = 'Cittadella')) as percentage;
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'
european_football_1
Of all the teams that played as a team away against Caen in the 2010 season, which one has the highest winning percentage?
Caen refers to HomeTeam; which one refers to AwayTeam; the highest winning percentage = MAX(DIVIDE(COUNT(FTR = 'A' where HomeTeam = 'Caen', season = '2010')), COUNT(Div where HomeTeam = 'Caen', season = '2010')) as percentage;
SELECT AwayTeam FROM matchs WHERE HomeTeam = 'Caen' AND season = 2010 AND FTR = 'A' GROUP BY AwayTeam ORDER BY COUNT(AwayTeam) DESC LIMIT 1
european_football_1
What percentage of matches played on 2005/07/30 belong to the F1 division?
Division refers to Div; DIVIDE(COUNT(Div = 'F1', Date = '2005/07/30'), COUNT(Div, Date = '2005/07/30')) as percentage;
SELECT CAST(SUM(CASE WHEN Div = 'F1' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Div) FROM matchs WHERE Date = '2005-07-30'
european_football_1
What percentage of all tied games did the Sassuolo team play in?
tied games refer FTR = 'D'; DIVIDE(COUNT(Div where FTR = 'D', HomeTeam = 'Sassuolo' or AwayTeam = 'Sassuolo'), COUNT(Div where HomeTeam = 'Sassuolo' or AwayTeam = 'Sassuolo')) as percentage;
SELECT CAST(SUM(CASE WHEN HomeTeam = 'Sassuolo' OR AwayTeam = 'Sassuolo' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(FTR) FROM matchs WHERE FTR = 'D'
european_football_1
What is the percentage whereby the away team scored 2 goals during the 2017 seasons?
scored 2 goals refers to FTAG = 2, which is short name for Final-time Away-team Goals; DIVIDE(COUNT(Div where season = 2017, FTAG = '2'), COUNT(Div where season = 2017)) as percentage;
SELECT CAST(SUM(CASE WHEN FTAG = 2 THEN 1 ELSE 0 END) / COUNT(FTAG) AS REAL) * 100 FROM matchs WHERE season = 2017
european_football_1
What is the name of all the teams that played in the EFL League One division?
all the teams include both HomeTeam and AwayTeam; name = 'EFL League One'; DIV = 'E2';
SELECT T1.HomeTeam,T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.name = 'EFL League One' and T1.Div = 'E2'
european_football_1
How many teams playing in divisions in Greece have ever scored 4 or more goals?
teams include both HomeTeam and AwayTeam; country = 'Greece'; scored 4 or more goals refer to FTAG≥4, which is short name for Final-time Away-team Goals;
SELECT COUNT(DISTINCT CASE WHEN T1.FTHG >= 4 THEN HomeTeam ELSE NULL end) + COUNT(DISTINCT CASE WHEN T1.FTAG >= 4 THEN AwayTeam ELSE NULL end) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.country = 'Greece'
european_football_1
How many matches played in the 2019 season of Scottish Championship league were ended with an equal result of 2-2?
matches refer to Div; Scottish Championship is a name of the league; equal result of 2-2 refers to FTAG = 2 AND FTHG = 2;
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2019 AND T2.name = 'Scottish Championship' AND T1.FTAG = 2 AND T1.FTHG = 2
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
european_football_1
What is the name of the home team in division P1 with the highest final time goal in all seasons?
the highest final time goal refers to MAX(FTHG); P1 = Div;
SELECT HomeTeam FROM matchs WHERE Div = 'P1' AND season = 2021 ORDER BY FTHG DESC LIMIT 1
european_football_1
What was the difference in home team and away team win percentages across all divisions in 2010?
2010 refers to season = 2010; SUBTRACT(DIVIDE(COUNT(Div where FTR = 'H', season = 2010), COUNT(Div where season = 2010)), COUNT(Div where FTR = 'A', season = 2010), COUNT(Div where season = 2010)) as percentage;
SELECT CAST(COUNT(CASE WHEN FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(FTR) - CAST(COUNT(CASE WHEN FTR = 'A' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(FTR) DIFFERENCE FROM matchs WHERE season = 2010
european_football_1
Which division had the most draft matches in the 2008 season?
the most draft matches refer to MAX(COUNT(Div)) where FTR = 'D';
SELECT Div FROM matchs WHERE season = 2008 AND FTR = 'D' GROUP BY Div ORDER BY COUNT(FTR) DESC LIMIT 1
european_football_1
Which team won the match in the EC division on January 20, 2008 at home?
won at home refers to FTR = 'H'; January 20, 2008 refers to Date = '2008-01-20'; EC division refers to Div = 'EC';
SELECT HomeTeam FROM matchs WHERE Div = 'EC' AND Date = '2008-01-20' AND FTR = 'H'
european_football_1
What is the name of the division in which Club Brugge and Genk competed on September 13, 2009?
September 13, 2009 refers to Date = '2009-09-13'; Club Brugge refers to HomeTeam; Genk refers to AwayTeam;
SELECT T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2009-09-13' and T1.HomeTeam = 'Club Brugge' AND T1.AwayTeam = 'Genk'
european_football_1
How many matches were played in the Scottish Premiership division from 2006 to 2008?
Scottish Premiership is a name of division; from 2006 to 2008 means seasons between 2006 and 2008;
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Scottish Premiership' AND (T1.season BETWEEN 2006 AND 2008)
european_football_1
In which division was the match between Hibernian, the away team, and Hearts, the home team, played? To which country does this division belong?
FALSE;
SELECT DISTINCT T2.division,T2.country FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.HomeTeam = 'Hearts' AND T1.AwayTeam = 'Hibernian'
european_football_1
Which away team in the division of Bundesliga has the highest final time goals?
Bundesliga is a name of division; the highest final time goals refers to MAX(FTAG);
SELECT T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.name = 'Bundesliga' ORDER BY T1.FTAG DESC LIMIT 1
european_football_1
Please provide the names of any three away teams that competed in the Italian divisions.
Italian means belong to country = 'Italy";
SELECT T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.country = 'Italy' LIMIT 3
european_football_1
What is the name of the division that has had the lowest number of draft matches in the 2019 season?
the lowest number of draft matches refers to MIN(COUNT(FTR = 'D'));
SELECT T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2019 AND T1.FTR = 'D' GROUP BY T2.division ORDER BY COUNT(FTR) LIMIT 1
european_football_1
How many times did Valencia's home team win in the LaLiga division?
LaLiga is a name of the division; Valencia's home team refers to HomeTeam = 'Valencia'; win refers to FTR = 'H';
SELECT COUNT(T1.HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga' AND T1.HomeTeam = 'Valencia' AND T1.FTR = 'H'
european_football_1
In how many matches in the Seria A division did both teams have equal goals?
Seria A is a name of division; equal goals refers to FTR = 'D', where D stands for draft;
SELECT COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Seria A' AND T1.FTR = 'D'
european_football_1
How many football divisions does England have?
England is the name of country;
SELECT COUNT(division) FROM divisions WHERE country = 'England'
european_football_1
What's the name of the football division in the Netherlands?
Netherlands is the name of country;
SELECT name FROM divisions WHERE country = 'Netherlands'
european_football_1
Who is the winner of the game happened on 2009/10/10, between "East Fife" and "Dumbarton"?
2009/10/10 is a date; the winner refers to FTR = 'A'; East Fife and Dumbarton are name of teams where HomeTeam = 'East Fife'; AwayTeam = 'Dumbarton';
SELECT CASE WHEN FTR = 'H' THEN 'East Fife' ELSE 'Dumbarton' END WINNER FROM matchs WHERE Date = '2009-10-10' AND HomeTeam = 'East Fife' AND AwayTeam = 'Dumbarton'