Chinastark/bird_dataset huggingface dataset:
Database: restaurant
Note: Mission Blvd. refers to street_name = 'mission blvd'; Hayward refers to city = 'hayward';
Question: List the review and label of the restaurants in Mission Blvd., Hayward.
SQL: SELECT generalinfo.review, generalinfo.label FROM LOCATION INNER JOIN generalinfo ON LOCATION.id_restaurant = generalinfo.id_restaurant WHERE generalinfo.city = 'hayward' AND LOCATION.street_name = 'mission blvd'
Database: restaurant
Note: indian restaurant refers to food_type = 'indian'; Castro St. refers to street_name = 'castro st'; Mountainview refers to city = 'mountainview'; have the word "Indian" in label refers to label = 'indian';
Question: Among all indian restaurants in Castro St., Mountainview, how many of them is about cookhouse in their label?
SQL: SELECT count(LOCATION.id_restaurant) FROM LOCATION INNER JOIN generalinfo ON LOCATION.id_restaurant = generalinfo.id_restaurant WHERE LOCATION.street_name = 'castro st' AND LOCATION.city = 'mountain view' AND generalinfo.food_type = 'indian' AND generalinfo.label LIKE '%cookhouse%'
Database: restaurant
Note: review of 2 refers to review = 2; street number below 500 refers to street_num < 500;
Question: In restaurants with a review of 2, how many restaurants have a street number below 500?
SQL: SELECT count(LOCATION.id_restaurant) FROM LOCATION INNER JOIN generalinfo ON LOCATION.id_restaurant = generalinfo.id_restaurant WHERE generalinfo.review = 2 AND LOCATION.street_num < 500
Database: restaurant
Note: asian restaurant refers to food_type = 'asian'; N. Milpitas Blvd. refers to street_name = 'n milpitas blvd'; Milpitas refers to city = 'milpitas'; restaurant ID greater than 385 refers to id_restaurant > 385;
Question: Among all asian restaurants in N. Milpitas Blvd., Milpitas, how many of them have restaurant ID greater than 385?
SQL: SELECT count(LOCATION.id_restaurant) AS num FROM LOCATION INNER JOIN generalinfo ON LOCATION.id_restaurant = generalinfo.id_restaurant WHERE generalinfo.city = 'milpitas' AND generalinfo.food_type = 'asian' AND LOCATION.street_name = 'n milpitas blvd' AND LOCATION.id_restaurant > 385
Database: restaurant
Note: restaurant's name refers to label; Ocean Avenue refers to street_name = 'ocean avenue'; San Francisco refers to city = 'san francisco';
Question: What is the restaurant's name and ID located at Ocean Avenue, San Francisco?
SQL: SELECT generalinfo.label, LOCATION.id_restaurant FROM LOCATION INNER JOIN generalinfo ON LOCATION.id_restaurant = generalinfo.id_restaurant WHERE LOCATION.city = 'san francisco' AND LOCATION.street_name = 'ocean avenue'
Database: restaurant
Note: full address refers to city, street_num, street_name; restaurant named "Sanuki Restaurant" refers to label = 'sanuki restaurant';
Question: What is the full address of the restaurant named "Sanuki Restaurant"?
SQL: SELECT generalinfo.city, LOCATION.street_num, LOCATION.street_name FROM LOCATION INNER JOIN generalinfo ON LOCATION.id_restaurant = generalinfo.id_restaurant WHERE generalinfo.label = 'sanuki restaurant'
Database: restaurant
Note: 22779 refers to street_num = 22779; 6th St. refers to street_name = '6th St';
Question: List the food type of the restaurant located in 22779 6th St., Hayward City.
SQL: SELECT generalinfo.food_type FROM LOCATION INNER JOIN generalinfo ON LOCATION.id_restaurant = generalinfo.id_restaurant WHERE LOCATION.street_num = 22779 AND LOCATION.street_name = '6th St' AND generalinfo.city = 'hayward'
Database: restaurant
Note: American restaurant refers to food_type = 'american'; Front refers to street_name = 'front'; San Francisco refers to city = 'san francisco';
Question: How many American restaurants are located in Front, San Francisco?
SQL: SELECT count(generalinfo.food_type = 'american') FROM LOCATION INNER JOIN generalinfo ON LOCATION.id_restaurant = generalinfo.id_restaurant WHERE LOCATION.city = 'san francisco' AND LOCATION.street_name = 'front'
Database: restaurant
Note: American restaurant refers to food_type = 'american'; street number greater than 2000 refers to street_num > 2000; review greater than the 70% of average review refers to review > multiply(avg(review), 0.7);
Question: List the restaurant's ID that has a review greater than the 70% of average review of all American restaurants with street number greater than 2000.
SQL: SELECT LOCATION.id_restaurant FROM LOCATION INNER JOIN generalinfo ON LOCATION.id_restaurant = generalinfo.id_restaurant WHERE generalinfo.food_type = 'american' AND LOCATION.street_num > 2000 GROUP BY LOCATION.id_restaurant ORDER BY avg(generalinfo.review) * 0.7 DESC
Database: restaurant
Note: street number ranges from 1000 to 2000 refers to 1000 <= street_num <= 2000; Afghani restaurant refers to food_type = 'afghani'; percentage = divide(count(id_restaurant where food_type = 'afghani'), count(id_restaurant)) * 100%;
Question: Among the restaurants located on the street number ranges from 1000 to 2000, what is the percentage of Afghani restaurants are there?
SQL: SELECT cast(sum(iif(generalinfo.food_type = 'afghani', 1, 0)) AS REAL) * 100 / count(LOCATION.id_restaurant) FROM LOCATION INNER JOIN generalinfo ON LOCATION.id_restaurant = generalinfo.id_restaurant WHERE 1000 <= LOCATION.street_num <= 2000
Database: restaurant
Note: the most popular refers to max(review); Asian food refers to food_type = 'asian'; San Francisco refers to city = 'san francisco';
Question: What is the name of the most popular restaurant serving Asian foods in San Francisco?
SQL: SELECT label FROM generalinfo WHERE food_type = 'asian' AND city = 'san francisco' AND review = ( SELECT max(review) FROM generalinfo WHERE food_type = 'asian' AND city = 'san francisco' )
Database: restaurant
Note: Monterey refers to region = 'monterey';
Question: How many cities are there in Monterey?
SQL: SELECT count(DISTINCT city) FROM geographic WHERE region = 'monterey'
Database: restaurant
Note: deli ris a food type; Belmont refers to city = 'belmont'; review rating of 2 or more refers to review > 2;
Question: How many deli in Belmont have a review rating of 2 or more?
SQL: SELECT count(id_restaurant) FROM generalinfo WHERE city = 'belmont' AND review > 2 AND food_type = 'deli'
Database: restaurant
Note: northern California refers to region = 'northern california'; the highest number of cities refers to max(count(city));
Question: Which county in northern California has the highest number of cities?
SQL: SELECT county FROM geographic WHERE region = 'northern california' GROUP BY county ORDER BY count(city) DESC LIMIT 1
Database: restaurant
Note: Concord refers to city = 'concord';
Question: How many restaurants can you find in Concord?
SQL: SELECT count(id_restaurant) FROM LOCATION WHERE city = 'concord'
Database: restaurant
Note: the top 4 most popular restaurant refers to top 4 max(review);
Question: In which region can you find the top 4 most popular restaurants?
SQL: SELECT geographic.region FROM generalinfo INNER JOIN geographic ON generalinfo.city = geographic.city ORDER BY generalinfo.review DESC LIMIT 4
Database: restaurant
Note: Chinese restaurant refers to food_type = 'chinese'; 1st st refers to street_name = '1st st'; Livermore refers to city = 'livermore';
Question: How many Chinese restaurants are there on 1st st, Livermore?
SQL: SELECT count(generalinfo.id_restaurant) FROM generalinfo INNER JOIN LOCATION ON generalinfo.id_restaurant = LOCATION.id_restaurant WHERE generalinfo.city = 'livermore' AND generalinfo.food_type = 'chinese' AND LOCATION.street_name = '1st st'
Database: restaurant
Note: Indian restaurant refers to food_type = 'indian'; the Los Angeles area refers to region = 'los angeles area';
Question: How many Indian restaurants are there in the Los Angeles area?
SQL: SELECT count(geographic.city) FROM geographic INNER JOIN generalinfo ON geographic.city = generalinfo.city WHERE generalinfo.food_type = 'indian' AND geographic.region = 'los angeles area'
Database: restaurant
Note: the Bay Area refers to region = 'bay area'; the most common type of food refers to max(count(food_type));
Question: In the Bay Area, what is the most common type of food served by restaurants?
SQL: SELECT generalinfo.food_type FROM geographic INNER JOIN generalinfo ON geographic.city = generalinfo.city WHERE geographic.region = 'bay area' GROUP BY generalinfo.food_type ORDER BY count(generalinfo.food_type) DESC LIMIT 1
Database: restaurant
Note: Broadway refers to street_name = 'broadway';  Oakland refers to city = 'oakland'; a review of no more than 3 refers to review < 3;
Question: How many restaurants in Broadway, Oakland received a review of no more than 3?
SQL: SELECT count(LOCATION.id_restaurant) FROM LOCATION INNER JOIN generalinfo ON LOCATION.city = generalinfo.city WHERE LOCATION.street_name = 'broadway' AND generalinfo.review < 3 AND LOCATION.city = 'oakland'
Database: restaurant
Note: the highest number refers to max(count(city)); Baskin Robbins restaurant refers to label = 'baskin robbins';
Question: In which region can you find the highest number of Baskin Robbins restaurants?
SQL: SELECT geographic.region AS num FROM generalinfo INNER JOIN geographic ON generalinfo.city = geographic.city WHERE generalinfo.label = 'baskin robbins' GROUP BY geographic.region ORDER BY count(generalinfo.city) DESC LIMIT 1
Database: restaurant
Note: street refers to street_name; pizza-serving restaurant refers to food_type = 'pizza'; San Jose refers to city = 'san jose';
Question: List all the streets where pizza-serving restaurants are found in San Jose.
SQL: SELECT LOCATION.street_name FROM LOCATION INNER JOIN generalinfo ON LOCATION.city = generalinfo.city WHERE generalinfo.food_type = 'pizza' AND LOCATION.city = 'san jose'
Database: restaurant
Question: How many types of restaurants are there in the Yosemite and Mono Lake area?
SQL: SELECT count(generalinfo.food_type) FROM geographic INNER JOIN generalinfo ON geographic.city = generalinfo.city WHERE geographic.region = 'yosemite and mono lake area'
Database: restaurant
Note: full address refers to street_num, street_name, city; the most popular refers to max(review);
Question: What is the full address of the most popular restaurant among the diners?
SQL: SELECT LOCATION.street_name, LOCATION.street_num, LOCATION.city FROM generalinfo INNER JOIN LOCATION ON generalinfo.id_restaurant = LOCATION.id_restaurant ORDER BY generalinfo.review DESC LIMIT 1
Database: restaurant
Note: restaurant refers to label; the highest number of branches refers to max(count(city));
Question: In which counties can you find the restaurant with the highest number of branches?
SQL: SELECT geographic.county FROM generalinfo INNER JOIN geographic ON generalinfo.city = geographic.city GROUP BY geographic.county ORDER BY count(generalinfo.label) DESC LIMIT 1
Database: restaurant
Note: the highest number refers to max(count(id_restaurant));
Question: Which region has the highest number of restaurants?
SQL: SELECT geographic.region FROM geographic INNER JOIN LOCATION ON geographic.city = LOCATION.city GROUP BY geographic.region ORDER BY count(LOCATION.id_restaurant) DESC LIMIT 1
Database: restaurant
Note: full address refers to street_num, street_name, city; American restaurant refers to food_type = 'american'; a review of 4 or more refers to review > 4;
Question: List the full address of all the American restaurants with a review of 4 or more?
SQL: SELECT LOCATION.street_num, LOCATION.street_name, LOCATION.city FROM LOCATION INNER JOIN generalinfo ON LOCATION.city = generalinfo.city WHERE generalinfo.review >= 4
Database: soccer_2016
Note: born after the year 1985 refers to SUBSTR(dob, 1, 4) > 1985;
Question: How many players were born after the year 1985?
SQL: SELECT count(player_id) FROM player WHERE substr(dob, 1, 4) > 1985
Database: soccer_2016
Note: in May 2008 refers to SUBSTR(match_date, 1, 4) = '2008' AND SUBSTR(match_date, 7, 1) = '5';
Question: How many matches were there in May, 2008?
SQL: SELECT count(match_id) FROM `match` WHERE substr(match_date, 1, 4) = '2008' AND substr(match_date, 7, 1) = '5'
Database: soccer_2016
Note: player no.41 won the "man of the match" refers to man_of_the_match = 41;
Question: For how many times has player no.41 won the "man of the match" award?
SQL: SELECT count(match_id) FROM `match` WHERE man_of_the_match = 41
Database: soccer_2016
Note: ID of matches refers to match_id; in the year 2008 refers to SUBSTR(match_date, 1, 4) = '2008';
Question: Please list the IDs of all the matches in the year 2008.
SQL: SELECT match_id FROM `match` WHERE substr(match_date, 1, 4) = '2008'
Database: soccer_2016
Note: Australia refers to country_name = 'Australia';
Question: How many players are from Australia?
SQL: SELECT count(CASE WHEN country.country_name = 'Australia' THEN player.player_id ELSE NULL END) FROM player INNER JOIN country ON player.country_name = country.country_id
Database: soccer_2016
Note: country refers to country_name; the oldest refers to min(dob);
Question: Which country is the oldest player from?
SQL: SELECT country.country_name FROM country INNER JOIN player ON player.country_name = country.country_id WHERE player.country_name IS NOT NULL ORDER BY player.dob LIMIT 1
Database: soccer_2016
Note: SC Ganguly refers to player_name = 'SC Ganguly';
Question: What is the bowling skill of SC Ganguly?
SQL: SELECT bowling_style.bowling_skill FROM bowling_style INNER JOIN player ON player.bowling_skill = bowling_style.bowling_id WHERE player.player_name = 'SC Ganguly'
Database: soccer_2016
Note: right hand as batting hand refers to batting_hand = 'Right-hand bat'; born after 1985 refers to SUBSTR(dob, 1, 4) > 1985;
Question: Among the players who use the right hand as their batting hand, how many of them were born after 1985?
SQL: SELECT sum(CASE WHEN substr(player.dob, 1, 4) > 1985 THEN 1 ELSE 0 END) FROM player INNER JOIN batting_style ON player.batting_hand = batting_style.batting_id WHERE batting_style.batting_hand = 'Right-hand bat'
Database: soccer_2016
Note: name of player refers to player_name; right hand as batting hand refers to batting_hand = 'Right-hand bat'; Australia refers to country_name = 'Australia';
Question: Please list the names of the players who use the right hand as their batting hand and are from Australia.
SQL: SELECT player.player_name FROM country INNER JOIN player ON player.country_name = country.country_id INNER JOIN batting_style ON player.batting_hand = batting_style.batting_id WHERE country.country_name = 'Australia' AND batting_style.batting_hand = 'Right-hand bat'
Database: soccer_2016
Note: Australia refers to country_name = 'Australia';
Question: Please list the bowling skills of all the players from Australia.
SQL: SELECT bowling_style.bowling_skill FROM player INNER JOIN bowling_style ON player.bowling_skill = bowling_style.bowling_id INNER JOIN country ON player.country_name = country.country_id WHERE country.country_name = 'Australia' GROUP BY bowling_style.bowling_skill
Database: soccer_2016
Note: the oldest refers to min(dob); date of birth refers to dob;
Question: Among the players whose bowling skill is "Legbreak", when was the oldest one of them born?
SQL: SELECT min(player.dob) FROM player INNER JOIN bowling_style ON player.bowling_skill = bowling_style.bowling_id WHERE bowling_style.bowling_skill = 'Legbreak'
Database: soccer_2016
Note: bowling skill used by most players refers to max(count(bowling_skill));
Question: What is the bowling skill used by most players?
SQL: SELECT bowling_style.bowling_skill FROM bowling_style INNER JOIN player ON player.bowling_skill = bowling_style.bowling_id GROUP BY bowling_style.bowling_skill ORDER BY count(bowling_style.bowling_skill) DESC LIMIT 1
Database: soccer_2016
Note: name of player refers to player_name; on 2008/4/18 refers to match_date = '2008-04-18';
Question: What is the name of the player who won the "man of the match" award in the match on 2008/4/18?
SQL: SELECT player.player_name FROM MATCH INNER JOIN player ON player.player_id = MATCH.man_of_the_match WHERE MATCH.match_date = '2008-04-18'
Database: soccer_2016
Note: SC Ganguly refers to player_name = 'SC Ganguly'; team captain refers to role_desc = 'Captain';
Question: For how many times has SC Ganguly played as team captain in a match?
SQL: SELECT sum(CASE WHEN rolee.role_desc = 'Captain' THEN 1 ELSE 0 END) FROM player INNER JOIN player_match ON player.player_id = player_match.player_id INNER JOIN rolee ON player_match.role_id = rolee.role_id WHERE player.player_name = 'SC Ganguly'
Database: soccer_2016
Note: role refers to of role_id; SC Ganguly refers to player_name = 'SC Ganguly'; on 2008/4/18 refers to match_date = '2008-04-18';
Question: What is the role of SC Ganguly in the match on 2008/4/18?
SQL: SELECT player_match.role_id FROM player INNER JOIN player_match ON player.player_id = player_match.player_id INNER JOIN rolee ON player_match.role_id = rolee.role_id INNER JOIN MATCH ON player_match.match_id = MATCH.match_id WHERE player.player_name = 'SC Ganguly' AND MATCH.match_date = '2008-04-18'
Database: soccer_2016
Note: SC Ganguly refers to player_name = 'SC Ganguly'; the highest winning margin refers to max(win_margin);
Question: Among all the matches SC Ganguly has played in, what is the highest winning margin?
SQL: SELECT max(MATCH.win_margin) FROM player INNER JOIN player_match ON player.player_id = player_match.player_id INNER JOIN MATCH ON player_match.match_id = MATCH.match_id WHERE player.player_name = 'SC Ganguly'
Database: soccer_2016
Note: SC Ganguly refers to player_name = 'SC Ganguly'; the average winning margin = divide(sum(win_margin), count(match_id)) where player_name = 'SC Ganguly';
Question: What is the average winning margin of all the matches SC Ganguly has played in?
SQL: SELECT cast(sum(MATCH.win_margin) AS REAL) / count(*) FROM player INNER JOIN player_match ON player.player_id = player_match.player_id INNER JOIN MATCH ON player_match.match_id = MATCH.match_id WHERE player.player_name = 'SC Ganguly'
Database: soccer_2016
Note: born after the year 1985 refers to SUBSTR(dob, 1, 4) > 1985; right hand as batting hand refers to batting_hand = 'Right-hand bat'; percentage = divide(count(player_id where batting_hand = 'Right-hand bat'), count(player_id)) * 100% where SUBSTR(dob, 1, 4) > 1985;
Question: Among all the players born after the year 1985, what is the percentage of the players who use the right hand as their batting hand?
SQL: SELECT cast(sum(CASE WHEN batting_style.batting_hand = 'Right-hand bat' THEN 1 ELSE 0 END) AS REAL) * 100 / count(player.player_id) FROM player INNER JOIN batting_style ON player.batting_hand = batting_style.batting_id WHERE substr(player.dob, 1, 4) > 1985
Database: soccer_2016
Note: name of player refers to player_name; the youngest refers to max(dob);
Question: Give the name of the youngest player.
SQL: SELECT player_name FROM player ORDER BY dob DESC LIMIT 1
Database: soccer_2016
Note: Sunrisers Hyderabad refers to team_name = 'Sunrisers Hyderabad'; time of toss winner refers to count(toss_winner);
Question: How many times has Sunrisers Hyderabad been the toss winner of a game?
SQL: SELECT sum(CASE WHEN toss_winner = ( SELECT team_id FROM team WHERE team_name = 'Sunrisers Hyderabad' ) THEN 1 ELSE 0 END) FROM `match`
Database: soccer_2016
Note: name of the striker refers to player_name; match no. 419169 refers to match_id = 419169; over no.3 refers to over_id = 3; ball no.2 refers to ball_id = 2; inning no.2 refers to innings_no = 2;
Question: Give the name of the striker in the match no. 419169, over no.3, ball no.2, inning no.2.
SQL: SELECT player.player_name FROM ball_by_ball INNER JOIN player ON ball_by_ball.striker = player.player_id WHERE ball_by_ball.match_id = 419169 AND ball_by_ball.over_id = 3 AND ball_by_ball.ball_id = 2 AND ball_by_ball.innings_no = 2
Database: soccer_2016
Note: name of venue refers to venue_name; a win margin of 138 points refers to win_margin = 138;
Question: Give the name of venue for the game with a win margin of 138 points.
SQL: SELECT venue.venue_name FROM `match` INNER JOIN venue ON match.venue_id = venue.venue_id WHERE match.win_margin = 138
Database: soccer_2016
Note: on 2008/5/12 refers to match_date = '2008-05-12'; name refers to player_name;
Question: For the game on 2008/5/12, who was the man of the match?
SQL: SELECT player.player_name FROM player INNER JOIN MATCH ON player.player_id = MATCH.man_of_the_match WHERE MATCH.match_date = '2008-05-12'
Database: soccer_2016
Note: name refers to player_name; captain keeper refers to role_desc = 'CaptainKeeper'; match no.419117 refers to match_id = '419117';
Question: State the name of captain keeper of the match no.419117.
SQL: SELECT player.player_name FROM player_match INNER JOIN rolee ON player_match.role_id = rolee.role_id INNER JOIN player ON player_match.player_id = player.player_id WHERE player_match.match_id = '419117' AND rolee.role_desc = 'CaptainKeeper'
Database: soccer_2016
Note: full name refers to player_name; in 2013 refers to season_year = 2013;
Question: Who was the man of the series in 2013? Give the full name.
SQL: SELECT player.player_name FROM season INNER JOIN player ON season.man_of_the_series = player.player_id WHERE season.season_year = 2013
Database: soccer_2016
Note: date of birth refers to dob; 2014 refers to season_year = 2014; Orange Cap winner refers to orange_cap IS NOT NULL;
Question: Give the date of birth of the 2014 Orange Cap winner.
SQL: SELECT player.dob FROM season INNER JOIN player ON season.man_of_the_series = player.player_id WHERE season.season_year = 2014 AND season.orange_cap IS NOT NULL
Database: soccer_2016
Note: nationality refers to country_name; the 7th season refers to season_id = 7; Purple Cap winner refers to purple_cap IS NOT NULL;
Question: What is the nationality of the 7th season Purple Cap winner?
SQL: SELECT country.country_name FROM season INNER JOIN player ON season.man_of_the_series = player.player_id INNER JOIN country ON player.country_name = country.country_id WHERE season.season_id = 7 AND season.purple_cap IS NOT NULL
Database: soccer_2016
Note: country refers to country_name; Ranchi city refers to city_name = 'Ranchi';
Question: Which country does Ranchi city belong to?
SQL: SELECT country.country_name FROM city INNER JOIN country ON city.country_id = country.country_id WHERE city.city_name = 'Ranchi'
Database: soccer_2016
Note: Indian refers to country_name = 'India';
Question: How many Indian cities are there in the database?
SQL: SELECT sum(CASE WHEN country.country_name = 'India' THEN 1 ELSE 0 END) FROM city INNER JOIN country ON city.country_id = country.country_id
Database: soccer_2016
Note: name of the city refers to city_name; the most venues refers to max(count(venue_id));
Question: State the name of the city with the most venues.
SQL: SELECT city.city_name FROM city INNER JOIN venue ON city.city_id = venue.city_id GROUP BY city.city_id ORDER BY count(venue.venue_id) DESC LIMIT 1
Database: soccer_2016
Note: MK Pandey refers to player_name = 'MK Pandey';
Question: What is the batting hand of MK Pandey?
SQL: SELECT batting_style.batting_hand FROM player INNER JOIN batting_style ON player.batting_hand = batting_style.batting_id WHERE player.player_name = 'MK Pandey'
Database: soccer_2016
Note: Indian refers to country_name = 'India'; South African refers to country_name = 'South Africa'; how many times = divide(count(city_id where country_name = 'India'), count(city_id where country_name = 'South Africa'));
Question: In the database, how many times is the number of Indian cities to the South African cities?
SQL: SELECT cast(sum(CASE WHEN country.country_name = 'India' THEN 1 ELSE 0 END) AS REAL) / sum(CASE WHEN country.country_name = 'South Africa' THEN 1 ELSE 0 END) FROM city INNER JOIN country ON city.country_id = country.country_id