1sf/bird-sql-train-with-schema huggingface dataset:
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: What is the total number of ranking criteria under the ranking system called Shanghai Ranking?
Evidence: ranking system called Shanghai Ranking refers to system_name = 'Shanghai Ranking';
SQL: SELECT COUNT(*) FROM ranking_system AS T1 INNER JOIN ranking_criteria AS T2 ON T1.id = T2.ranking_system_id WHERE T1.system_name = 'Shanghai Ranking'
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: Give the name and score of the university ID 124.
Evidence: name of university refers to university_name;
SQL: SELECT T2.university_name, T1.score FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T2.id = 124
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: How many female students are there in University of Pennsylvania in 2011?
Evidence: in 2011 refers to year 2011; female students refers to DIVIDE(MULTIPLY(num_students, pct_female_students), 100); University of Pennsylvania refers to a university name;
SQL: SELECT CAST(T1.num_students * T1.pct_female_students AS REAL) / 100 FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2011 AND T2.university_name = 'University of Pennsylvania'
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: List down all universities that scored below 50.
Evidence: scored below 50 refers to score < 50; all universities refers to university_name;
SQL: SELECT DISTINCT T2.university_name FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.score < 50
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: How many universities are located in Japan?
Evidence: located in Japan refers to country_name = 'Japan';
SQL: SELECT COUNT(*) FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T2.country_name = 'Japan'
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: Provide the name of the university with the highest number of male students.
Evidence: highest number of female students refers to MAX(SUBTRACT(num_students, DIVIDE(MULTIPLY(num_students, pct_female_students), 100))); name of university refers to university_name
SQL: SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id ORDER BY T1.num_students * T1.pct_female_students / 100 - T1.num_students DESC LIMIT 1
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: List the countries of universities that scored 70 and below in 2016.
Evidence: scored 70 and below refers to score < 70; in 2016 refers to year = 2016
SQL: SELECT DISTINCT T3.country_name FROM university AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.university_id INNER JOIN country AS T3 ON T3.id = T1.country_id WHERE T2.score < 70 AND T2.year = 2016
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: Calculate number of male students in Emory University in 2011.
Evidence: in 2011 refers to year 2011; number of male students refers to SUBTRACT(num_students, DIVIDE(MULTIPLY(num_students, pct_male_students), 100)); in Emory University refers to university_name = 'Emory University'
SQL: SELECT CAST((T1.num_students - (T1.num_students * T1.pct_female_students)) AS REAL) / 100 FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T2.university_name = 'Emory University' AND T1.year = 2011
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: In which country does Johns Hopkins University located?
Evidence: Johns Hopkins University refers to university_name = 'Johns Hopkins University'; which country refers to country_name
SQL: SELECT T2.country_name FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T1.university_name = 'Johns Hopkins University'
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: Give the names of universities with number of students ranges from 400 to 1000.
Evidence: number of students ranges from 400 to 1000 refers to num_students BETWEEN 400 AND 1000; name of university refers to university_name
SQL: SELECT DISTINCT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.num_students BETWEEN 400 AND 1000
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: In what year does the Brown University score the highest?
Evidence: Brown University refers to university_name = 'Brown University'; score the highest refers to MAX(score)
SQL: SELECT T1.year FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T2.university_name = 'Brown University' ORDER BY T1.score DESC LIMIT 1
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: Calculate the average score of Emory University from 2011 to 2016.
Evidence: average score refers to avg(score); Emory University refers to university_name = 'Emory University'; from 2011 to 2016 refers to year BETWEEN 2011 AND 2016;
SQL: SELECT AVG(T1.score) FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T2.university_name = 'Emory University' AND T1.year BETWEEN 2011 AND 2016
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: Give the name of the university with the most number of students in 2015.
Evidence: most number of students refers to MAX(num_students); in 2015 refers to year = 2015; name of university refers to university_name;
SQL: SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2015 ORDER BY T1.num_students DESC LIMIT 1
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: What is the location and number of female students in university ID 23 in 2011?
Evidence: in 2011 refers to year 2011; female students refers to DIVIDE(MULTIPLY(num_students, pct_female_students), 100); location refers to country_name
SQL: SELECT T3.country_name, CAST(T2.num_students * T2.pct_female_students AS REAL) / 100 FROM university AS T1 INNER JOIN university_year AS T2 ON T1.id = T2.university_id INNER JOIN country AS T3 ON T3.id = T1.country_id WHERE T2.year = 2011 AND T1.id = 23
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: How many universities scored 40 in teaching criteria?
Evidence: scored 40 refers to score = 40; in teaching refers to criteria_name = 'Teaching'
SQL: SELECT COUNT(*) FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id WHERE T2.score = 40 AND T1.criteria_name = 'Teaching' AND T2.score = 40
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: Among the universities in United States of America, what is the percentage of female students in year 2016?
Evidence: female students refers to DIVIDE(MULTIPLY(num_students, pct_female_students), 100); in United States of America refers to country_name = 'United States of America'; percentage refers to DIVIDE(SUM(DIVIDE(MULTIPLY(num_students, pct_female_students), 100)), SUM(num_students))
SQL: SELECT SUM(CAST(T2.pct_female_students * T2.num_students AS REAL) / 100) * 100 / SUM(T2.num_students) FROM university AS T1 INNER JOIN university_year AS T2 ON T1.id = T2.university_id INNER JOIN country AS T3 ON T3.id = T1.country_id WHERE T3.country_name = 'United States of America' AND T2.year = 2016
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: Calculate the difference between the total number of students and the number of international international students in Univeristy of Tokyo from 2011 to 2014.
Evidence: international students refers to DIVIDE(MULTIPLY(num_students, pct_international_students), 100); difference refers to SUBTRACT(SUM(num_students), SUM(DIVIDE(MULTIPLY(num_students, pct_international_students), 100))); in University of Tokyo refers to university_name = 'University of Tokyo'; from 2011 to 2014 refers to year BETWEEN 2011 AND 2014
SQL: SELECT SUM(T1.num_students) - SUM(CAST(T1.num_students * T1.pct_international_students AS REAL) / 100) FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year BETWEEN 2011 AND 2014 AND T2.university_name = 'University of Tokyo'
Database: university
Tables: country, ranking_system, ranking_criteria, university, university_ranking_year, university_year
Columns (table index, column name): -1, *, 0, id, 0, country_name, 1, id, 1, system_name, 2, id, 2, ranking_system_id, 2, criteria_name, 3, id, 3, country_id, 3, university_name, 4, university_id, 4, ranking_criteria_id, 4, year, 4, score, 5, university_id, 5, year, 5, num_students, 5, student_staff_ratio, 5, pct_international_students, 5, pct_female_students
Question: List the names of universities with a score less than 28% of the average score of all universities in 2015.
Evidence: in 2015 refers to year = 2015; score less than 28% refers to score < MULTIPLY(avg(score), 0.28) where year = 2015; names of universities refers to university_name
SQL: SELECT T2.university_name FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2015 AND T1.score * 100 < ( SELECT AVG(score) * 28 FROM university_ranking_year WHERE year = 2015 )
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: How many units of item no.9 were sold in store no.1 on 2012/1/1?
Evidence: store no. 1 refers to store_nbr = 1; item no. 9 refers to item_nbr = 9; on 2012/1/1 refers to date = '2012-01-01'
SQL: SELECT units FROM sales_in_weather WHERE `date` = '2012-01-01' AND store_nbr = 1 AND item_nbr = 9
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: How many units of item no.9 were sold in store no.1 in total in January, 2012?
Evidence: store no. 1 refers to store_nbr = 1; item no. 9 refers to item_nbr = 9; in January refers to SUBSTR(date, 1, 4) = '2012' and SUBSTR(date, 6, 2) = '01'
SQL: SELECT SUM(units) FROM sales_in_weather WHERE SUBSTR(`date`, 6, 2) = '01' AND SUBSTR(`date`, 1, 4) = '2012' AND item_nbr = 9 AND store_nbr = 1
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: What is the ID of the item that sold the best on 2012/1/1 in store no.1?
Evidence: sold on 2012/1/1 refers to date = '2012-01-01'; in store no.1 refers to store_nbr = 1; item sold the best refers to Max(units)
SQL: SELECT item_nbr FROM sales_in_weather WHERE `date` = '2012-01-01' AND store_nbr = 1 ORDER BY units DESC LIMIT 1
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: What was the temperature range of station no.1 on 2012/1/1?
Evidence: on 2012/1/1 refers to date = '2012-01-01'; temperature range refers to Subtract (tmax, tmin); station no.1 refers to station_nbr = 1
SQL: SELECT tmax - tmin AS temrange FROM weather WHERE station_nbr = 1 AND `date` = '2012-01-01'
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: Please list the dates on which the temperature of station no.2 was above the 30-year normal.
Evidence: temperature above the 30-year normal refers to depart > 0; station no.2 refers to station_nbr = 2
SQL: SELECT `date` FROM weather WHERE station_nbr = 2 AND depart > 0
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: On which day was the weather more windy in station no.1, 2012/1/1 or 2012/1/2?
Evidence: station no.1 refers to station_nbr = 1; 2012/1/1 refers to date = '2012-01-01'; 2012/1/2 refers to date = '2012-01-02'; more windy refers to Max(avgspeed)
SQL: SELECT CASE WHEN (SUM(CASE WHEN `date` = '2012-01-01' THEN avgspeed ELSE 0 END) - SUM(CASE WHEN `date` = '2012-01-02' THEN avgspeed ELSE 0 END)) > 0 THEN '2012-01-01' ELSE '2012-01-02' END FROM weather WHERE station_nbr = 1
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: What is the total number of units of item no.5 sold in store no.3 in 2012 on days when the temperature was below the 30-year normal?
Evidence: item no.5 refers to item_nbr = 5; store no. 3 refers to store_nbr = 3; when the temperature was below the 30-year normal refers to depart < 0; in 2012 refers to SUBSTR(date, 1, 4) = '2012'; total number of units refers to Sum(units)
SQL: SELECT SUM(CASE WHEN T3.depart < 0 THEN units ELSE 0 END) AS sum FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.item_nbr = 5
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: How many units of item no.5 were sold in store no.3 on the day in 2012 when the max temperature was the highest?
Evidence: item no.5 refers to item_nbr = 5; store no. 3 refers to store_nbr = 3; when the max temperature was highest refers to Max(tmax); in 2012 refers to SUBSTR(date, 1, 4) = '2012'
SQL: SELECT T1.units FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.item_nbr = 5 ORDER BY tmax DESC LIMIT 1
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: What was the dew point on the day the most units of item no.5 were sold in store no.3 in 2012?
Evidence: item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; in 2012 refers to SUBSTR(date, 1, 4) = '2012': most units sold refers to Max(units)
SQL: SELECT dewpoint FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.item_nbr = 5 ORDER BY units DESC LIMIT 1