input stringlengths 122 2.7k | output stringlengths 24 805 |
|---|---|
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT SUM(CASE WHEN T3.Role_Desc = 'Captain' THEN 1 ELSE 0 END) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Rolee AS T3 ON T2.Role_Id = T3.Role_Id WHERE T1.Player_Name = 'SC Ganguly'; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T2.Role_Id FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Rolee AS T3 ON T2.Role_Id = T3.Role_Id INNER JOIN Match AS T4 ON T2.Match_Id = T4.Match_Id WHERE T1.Player_Name = 'SC Ganguly' AND T4.Match_Date = '2008-04-18'; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT MAX(T3.Win_Margin) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Match AS T3 ON T2.Match_Id = T3.Match_Id WHERE T1.Player_Name = 'SC Ganguly'; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT CAST(SUM(T3.Win_Margin) AS REAL) / COUNT(*) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T1.Player_Id = T2.Player_Id INNER JOIN Match AS T3 ON T2.Match_Id = T3.Match_Id WHERE T1.Player_Name = 'SC Ganguly'; |
[INST] Here is a database schema:
Batting_Style :
Batting_Id [ INTEGER ] primary_key
Batting_hand [ TEXT ]
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.B... | SELECT CAST(SUM(CASE WHEN T2.Batting_Hand = 'Right-hand bat' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Player_Id) FROM Player AS T1 INNER JOIN Batting_Style AS T2 ON T1.Batting_hand = T2.Batting_Id WHERE SUBSTR(T1.DOB, 1, 4) > 1985; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT Player_Name FROM Player ORDER BY DOB DESC LIMIT 1; |
[INST] Please write me a SQL statement that answers the following question: How many times has Sunrisers Hyderabad been the toss winner of a game? [/INST] [/INST] | SELECT SUM(CASE WHEN Toss_Winner = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Sunrisers Hyderabad' ) THEN 1 ELSE 0 END) FROM `Match`; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T2.Player_Name FROM Ball_by_Ball AS T1 INNER JOIN Player AS T2 ON T1.Striker = T2.Player_Id WHERE T1.Match_Id = 419169 AND T1.Over_Id = 3 AND T1.Ball_Id = 2 AND T1.Innings_No = 2; |
[INST] Please write me a SQL statement that answers the following question: Give the name of venue for the game with a win margin of 138 points. [/INST] [/INST] | SELECT T2.Venue_Name FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T1.Win_Margin = 138; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Match AS T2 ON T1.Player_Id = T2.Man_of_the_Match WHERE T2.Match_Date = '2008-05-12'; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T3.Player_Name FROM Player_Match AS T1 INNER JOIN Rolee AS T2 ON T1.Role_Id = T2.Role_Id INNER JOIN Player AS T3 ON T1.Player_Id = T3.Player_Id WHERE T1.Match_Id = '419117' AND T2.Role_Desc = 'CaptainKeeper'; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T2.Player_Name FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id WHERE T1.Season_Year = 2013; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T2.DOB FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id WHERE T1.Season_Year = 2014 AND T1.Orange_Cap IS NOT NULL; |
[INST] Here is a database schema:
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling... | SELECT T3.Country_Name FROM Season AS T1 INNER JOIN Player AS T2 ON T1.Man_of_the_Series = T2.Player_Id INNER JOIN Country AS T3 ON T2.Country_Name = T3.Country_Id WHERE T1.Season_Id = 7 AND T1.Purple_Cap IS NOT NULL; |
[INST] Here is a database schema:
City :
City_Id [ INTEGER ] primary_key
City_Name [ TEXT ]
Country_id [ INTEGER ]
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Please write me a SQL statement that answers the following question: Which country does Ranchi city belong to? [/INST] [/INST] | SELECT T2.Country_Name FROM City AS T1 INNER JOIN Country AS T2 ON T1.Country_Id = T2.Country_Id WHERE T1.City_Name = 'Ranchi'; |
[INST] Here is a database schema:
City :
City_Id [ INTEGER ] primary_key
City_Name [ TEXT ]
Country_id [ INTEGER ]
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Please write me a SQL statement that answers the following question: How many Indian cities are there in the database? [/INST] [/INST] | SELECT SUM(CASE WHEN T2.Country_Name = 'India' THEN 1 ELSE 0 END) FROM City AS T1 INNER JOIN Country AS T2 ON T1.Country_Id = T2.Country_Id; |
[INST] Here is a database schema:
City :
City_Id [ INTEGER ] primary_key
City_Name [ TEXT ]
Country_id [ INTEGER ]
Venue :
Venue_Id [ INTEGER ] primary_key
Venue_Name [ TEXT ]
City_Id [ INTEGER ] Venue.City_Id = City.City_Id
Please write me a SQL statement that answers the following question: State the name of the cit... | SELECT T1.City_Name FROM City AS T1 INNER JOIN Venue AS T2 ON T1.City_Id = T2.City_Id GROUP BY T1.City_Id ORDER BY COUNT(T2.Venue_Id) DESC LIMIT 1; |
[INST] Here is a database schema:
Batting_Style :
Batting_Id [ INTEGER ] primary_key
Batting_hand [ TEXT ]
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.B... | SELECT T2.Batting_hand FROM Player AS T1 INNER JOIN Batting_Style AS T2 ON T1.Batting_hand = T2.Batting_Id WHERE T1.Player_Name = 'MK Pandey'; |
[INST] Here is a database schema:
City :
City_Id [ INTEGER ] primary_key
City_Name [ TEXT ]
Country_id [ INTEGER ]
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Please write me a SQL statement that answers the following question: In the database, how many times is the number of Indian cities to th... | SELECT CAST(SUM(CASE WHEN T2.Country_Name = 'India' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.Country_Name = 'South Africa' THEN 1 ELSE 0 END) FROM City AS T1 INNER JOIN Country AS T2 ON T1.Country_Id = T2.Country_Id; |
[INST] Please write me a SQL statement that answers the following question: How many times does M Chinnaswamy Stadium host games than Maharashtra Cricket Association Stadium? [/INST] [/INST] | SELECT SUM(CASE WHEN T2.Venue_Name = 'M Chinnaswamy Stadium' THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.Venue_Name = 'Maharashtra Cricket Association Stadium' THEN 1 ELSE 0 END) FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT Player_Name FROM Player ORDER BY DOB ASC LIMIT 1; |
[INST] Please write me a SQL statement that answers the following question: How many matches were played on May 2008? [/INST] [/INST] | SELECT SUM(CASE WHEN SUBSTR(Match_Date, 7, 1) = '5' THEN 1 ELSE 0 END) FROM `Match` WHERE SUBSTR(Match_Date, 1, 4) = '2008'; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT COUNT(Player_Id) AS cnt FROM Player WHERE DOB BETWEEN '1990-01-01' AND '1999-12-31'; |
[INST] Please write me a SQL statement that answers the following question: How many matches did Team 10 play in 2012? [/INST] [/INST] | SELECT SUM(CASE WHEN Team_1 = 10 OR Team_2 = 10 THEN 1 ELSE 0 END) FROM `Match` WHERE SUBSTR(Match_Date, 1, 4) = '2012'; |
[INST] Here is a database schema:
Season :
Season_Id [ INTEGER ] primary_key
Man_of_the_Series [ INTEGER ]
Orange_Cap [ INTEGER ]
Purple_Cap [ INTEGER ]
Season_Year [ INTEGER ]
Please write me a SQL statement that answers the following question: List the id of the player who won the Orange Cap for 2 consecutive season... | SELECT Orange_Cap FROM Season GROUP BY Orange_Cap HAVING COUNT(Season_Year) > 1; |
[INST] Please write me a SQL statement that answers the following question: How many matches were played in Season 7? [/INST] [/INST] | SELECT COUNT(Match_Id) FROM `Match` WHERE Season_Id = 7; |
[INST] Here is a database schema:
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Umpire :
Umpire_Id [ INTEGER ] primary_key
Umpire_Name [ TEXT ]
Umpire_Country [ INTEGER ] Umpire.Umpire_Country = Country.Country_Id
Please write me a SQL statement that answers the following question: How many umpire... | SELECT SUM(CASE WHEN T1.Country_Name = 'South Africa' THEN 1 ELSE 0 END) FROM Country AS T1 INNER JOIN Umpire AS T2 ON T1.Country_ID = T2.Umpire_Country; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Match AS T2 ON T1.Player_Id = T2.Man_of_the_Match GROUP BY T2.Man_of_the_Match ORDER BY COUNT(T2.Man_of_the_Match) DESC LIMIT 1; |
[INST] Here is a database schema:
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling... | SELECT T1.Country_Name FROM Country AS T1 INNER JOIN Player AS T2 ON T1.Country_Id = T2.Country_Name GROUP BY T2.Country_Name ORDER BY COUNT(T2.Country_Name) DESC LIMIT 1; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT SUM(CASE WHEN T1.Player_Name = 'CH Gayle' THEN 1 ELSE 0 END) AS cnt FROM Player AS T1 INNER JOIN Season AS T2 ON T1.Player_Id = T2.Orange_Cap; |
[INST] Please write me a SQL statement that answers the following question: Which season played the highest number of matches at M Chinnaswamy Stadium? [/INST] [/INST] | SELECT T1.Season_Id FROM `Match` AS T1 INNER JOIN Venue AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T2.Venue_Name = 'M Chinnaswamy Stadium' GROUP BY T1.Season_Id ORDER BY COUNT(T1.Season_Id) DESC LIMIT 1; |
[INST] Please write me a SQL statement that answers the following question: What is the name of the team that won the most number of matches in season 1? [/INST] [/INST] | SELECT Team_Name FROM Team WHERE Team_Id = ( SELECT Match_Winner FROM `Match` WHERE season_Id = 1 GROUP BY Match_Winner ORDER BY COUNT(Match_Winner) DESC LIMIT 1 ); |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Venue :
Venue_Id [ INTEGER ] primary_key
Venue_Name [ TEXT ]
City_Id [ INTEGER ] Venue.City_Id = City.City_Id
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_... | SELECT T3.Venue_Name FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Team_1 INNER JOIN Venue AS T3 ON T2.Venue_Id = T3.Venue_Id WHERE T1.Team_Name = 'Kolkata Knight Riders' GROUP BY T3.Venue_Id ORDER BY COUNT(T3.Venue_Id) DESC LIMIT 1; |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEG... | SELECT T1.Team_Name FROM Team AS T1 INNER JOIN ( SELECT COUNT(Team_1) AS a, Team_1 FROM Match WHERE Team_1 <> Match_Winner GROUP BY Team_1 UNION SELECT COUNT(Team_2) AS a, Team_2 FROM Match WHERE Team_2 <> Match_Winner GROUP BY Team_2 ORDER BY a DESC LIMIT 1 ) AS T2 ON T1.Team_Id = T2.Team_1; |
[INST] Please write me a SQL statement that answers the following question: Who is the player who won the first ever "man of the match" award? [/INST] [/INST] | SELECT Player_Name FROM Player WHERE Player_Id = ( SELECT Man_of_the_Match FROM `Match` ORDER BY match_date ASC LIMIT 1 ); |
[INST] Please write me a SQL statement that answers the following question: When did Chennai Super Kings play its first match? [/INST] [/INST] | SELECT Match_Date FROM `Match` WHERE team_1 = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Chennai Super Kings' ) OR Team_2 = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Chennai Super Kings' ) ORDER BY Match_Date ASC LIMIT 1; |
[INST] Here is a database schema:
Batting_Style :
Batting_Id [ INTEGER ] primary_key
Batting_hand [ TEXT ]
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_... | SELECT SUM(CASE WHEN T1.Batting_hand = 'Left-hand bat' THEN 1 ELSE 0 END) AS cnt FROM Batting_Style AS T1 INNER JOIN Player AS T2 ON T1.Batting_Id = T2.Batting_hand INNER JOIN Country AS T3 ON T2.Country_Name = T3.Country_Id WHERE T3.Country_Name = 'India'; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T4.Player_Name FROM Team AS T1 INNER JOIN Player_Match AS T2 ON T1.Team_id = T2.Team_id INNER JOIN Rolee AS T3 ON T2.Role_Id = T3.Role_Id INNER JOIN Player AS T4 ON T2.Player_Id = T4.Player_Id WHERE T1.Team_Name = 'Deccan Chargers' AND T1.Team_Id = 8 AND T3.Role_Desc = 'Captain' AND T3.Role_Id = 1 GROUP BY T4.Pl... |
[INST] Here is a database schema:
Batting_Style :
Batting_Id [ INTEGER ] primary_key
Batting_hand [ TEXT ]
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.B... | SELECT CAST(SUM(CASE WHEN T1.Batting_hand = 'Right-hand bat' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Player_Id) FROM Batting_Style AS T1 INNER JOIN Player AS T2 ON T2.Batting_hand = T1.Batting_Id; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT Player_name FROM Player WHERE DOB = '1981-07-07'; |
[INST] Here is a database schema:
Player_Match :
Match_Id [ INTEGER ] Player_Match.Match_Id = Match.Match_Id
Player_Id [ INTEGER ] Player_Match.Player_Id = Player.Player_Id
Role_Id [ INTEGER ] Player_Match.Role_Id = Rolee.Role_Id
Team_Id [ INTEGER ] Player_Match.Team_Id = Team.Team_Id
Please write me a SQL statement t... | SELECT SUM(CASE WHEN Player_Id = 2 THEN 1 ELSE 0 END) FROM Player_Match; |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEG... | SELECT T2.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_1 ORDER BY T1.Win_Margin DESC LIMIT 1; |
[INST] Here is a database schema:
City :
City_Id [ INTEGER ] primary_key
City_Name [ TEXT ]
Country_id [ INTEGER ]
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Venue :
Venue_Id [ INTEGER ] primary_key
Venue_Name [ TEXT ]
City_Id [ INTEGER ] Venue.City_Id = City.City_Id
Please write me a SQL state... | SELECT T3.Country_Name FROM Venue AS T1 INNER JOIN City AS T2 ON T2.City_Id = T1.City_Id INNER JOIN Country AS T3 ON T3.Country_Id = T2.Country_id WHERE T1.Venue_Name = 'St George''s Park'; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T3.Team_Name FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T2.Player_Id = T1.Player_Id INNER JOIN Team AS T3 ON T3.Team_Id = T2.Team_Id WHERE T2.Match_Id = 335990 AND T3.Team_Name = 'Mumbai Indians' GROUP BY T3.Team_Name; |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEG... | SELECT T1.Team_Name FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner WHERE T2.Match_Date = '2009-05-07' AND T2.Win_Margin = 7; |
[INST] Here is a database schema:
Outcome :
Outcome_Id [ INTEGER ] primary_key
Outcome_Type [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_I... | SELECT SUM(CASE WHEN T2.Outcome_Type = 'Superover' THEN 1 ELSE 0 END) FROM Match AS T1 INNER JOIN Outcome AS T2 ON T2.Outcome_Id = T1.Outcome_type; |
[INST] Here is a database schema:
City :
City_Id [ INTEGER ] primary_key
City_Name [ TEXT ]
Country_id [ INTEGER ]
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Please write me a SQL statement that answers the following question: List the cities located in U.A.E. [/INST] [/INST] | SELECT T1.City_Name FROM City AS T1 INNER JOIN Country AS T2 ON T2.Country_Id = T1.Country_id WHERE T2.Country_Name = 'U.A.E'; |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEG... | SELECT SUM(CASE WHEN T2.Team_Name = 'Pune Warriors' THEN 1 ELSE 0 END) FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Match_Winner; |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEG... | SELECT T2.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Match_Winner WHERE T1.Match_Date LIKE '2015%' AND T1.Match_Id = 829768; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T3.Role_Desc FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T2.Player_Id = T1.Player_Id INNER JOIN Rolee AS T3 ON T3.Role_Id = T2.Role_Id WHERE T2.Match_Id = 335992 AND T1.Player_Name = 'K Goel'; |
[INST] Here is a database schema:
City :
City_Id [ INTEGER ] primary_key
City_Name [ TEXT ]
Country_id [ INTEGER ]
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Please write me a SQL statement that answers the following question: How many cities are located in South Africa? [/INST] [/INST] | SELECT SUM(CASE WHEN T2.Country_Name = 'South Africa' THEN 1 ELSE 0 END) FROM City AS T1 INNER JOIN Country AS T2 ON T2.Country_Id = T1.Country_id; |
[INST] Here is a database schema:
Venue :
Venue_Id [ INTEGER ] primary_key
Venue_Name [ TEXT ]
City_Id [ INTEGER ] Venue.City_Id = City.City_Id
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ]... | SELECT SUM(CASE WHEN T2.Venue_Name = 'Newlands' THEN 1 ELSE 0 END) FROM Match AS T1 INNER JOIN Venue AS T2 ON T2.Venue_Id = T1.Venue_Id; |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEG... | SELECT T1.Win_Margin FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_1 INNER JOIN Team AS T3 ON T3.Team_Id = T1.Team_2 WHERE (T2.Team_Name = 'Mumbai Indians' AND T3.Team_Name = 'Royal Challengers Bangalore' AND T1.Match_Date = '2008-05-28') OR (T2.Team_Name = 'Royal Challengers Bangalore' AND T3.Team_Nam... |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEG... | SELECT DISTINCT CASE WHEN T1.Win_Margin < ( SELECT AVG(Win_Margin) * 0.3 FROM Match WHERE Match_Date LIKE '2011%' ) THEN T2.Team_Name END, CASE WHEN T1.Win_Margin < ( SELECT AVG(Win_Margin) * 0.3 FROM Match WHERE Match_Date LIKE '2011%' ) THEN T3.Team_Name END FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.T... |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT CAST(SUM(CASE WHEN T1.Role_Desc = 'Captain' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Role_Id) FROM Rolee AS T1 INNER JOIN Player_Match AS T2 ON T2.Role_Id = T1.Role_Id INNER JOIN Player AS T3 ON T3.Player_Id = T2.Player_Id WHERE T3.DOB LIKE '1977%'; |
[INST] Here is a database schema:
Ball_by_Ball :
Match_Id [ INTEGER ] Ball_by_Ball.Match_Id = Match.Match_Id
Over_Id [ INTEGER ]
Ball_Id [ INTEGER ]
Innings_No [ INTEGER ]
Team_Batting [ INTEGER ]
Team_Bowling [ INTEGER ]
Striker_Batting_Position [ INTEGER ]
Striker [ INTEGER ]
Non_Striker [ INTEGER ]
Bowler [ INTEGER ... | SELECT COUNT(Over_Id) FROM Ball_by_Ball WHERE Match_Id = 335996 AND Innings_No = 1; |
[INST] Here is a database schema:
Batsman_Scored :
Match_Id [ INTEGER ] Batsman_Scored.Match_Id = Match.Match_Id
Over_Id [ INTEGER ]
Ball_Id [ INTEGER ]
Runs_Scored [ INTEGER ]
Innings_No [ INTEGER ]
Please write me a SQL statement that answers the following question: List the over IDs, ball IDs, and innings numbers o... | SELECT Over_Id, Ball_Id, Innings_No FROM Batsman_Scored WHERE Match_Id = 336004 ORDER BY Runs_Scored DESC LIMIT 1; |
[INST] Here is a database schema:
Ball_by_Ball :
Match_Id [ INTEGER ] Ball_by_Ball.Match_Id = Match.Match_Id
Over_Id [ INTEGER ]
Ball_Id [ INTEGER ]
Innings_No [ INTEGER ]
Team_Batting [ INTEGER ]
Team_Bowling [ INTEGER ]
Striker_Batting_Position [ INTEGER ]
Striker [ INTEGER ]
Non_Striker [ INTEGER ]
Bowler [ INTEGER ... | SELECT Match_Id FROM Ball_by_Ball WHERE Over_Id = 20 GROUP BY Match_Id LIMIT 5; |
[INST] Here is a database schema:
Wicket_Taken :
Match_Id [ INTEGER ] Wicket_Taken.Match_Id = Match.Match_Id
Over_Id [ INTEGER ]
Ball_Id [ INTEGER ]
Player_Out [ INTEGER ] Wicket_Taken.Player_Out = Player.Player_Id
Kind_Out [ INTEGER ] Wicket_Taken.Kind_Out = Out_Type.Out_Id
Fielders [ INTEGER ] Wicket_Taken.Fielders =... | SELECT SUM(CASE WHEN Match_Id = 548335 THEN 1 ELSE 0 END) FROM Wicket_Taken WHERE Innings_No = 1; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT Player_name FROM Player WHERE DOB LIKE '1971%'; |
[INST] Here is a database schema:
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEGER ] Match.Venue_Id = Venue.Venue_Id
Toss_Winner [ INTEGER... | SELECT Match_Id FROM Match WHERE Match_Date LIKE '%2015-04-18%'; |
[INST] Here is a database schema:
Out_Type :
Out_Id [ INTEGER ] primary_key
Out_Name [ TEXT ]
Wicket_Taken :
Match_Id [ INTEGER ] Wicket_Taken.Match_Id = Match.Match_Id
Over_Id [ INTEGER ]
Ball_Id [ INTEGER ]
Player_Out [ INTEGER ] Wicket_Taken.Player_Out = Player.Player_Id
Kind_Out [ INTEGER ] Wicket_Taken.Kind_Out = ... | SELECT T1.Match_Id FROM Wicket_Taken AS T1 INNER JOIN Out_Type AS T2 ON T2.Out_Id = T1.Kind_Out WHERE T2.Out_Name = 'hit wicket'; |
[INST] Here is a database schema:
Out_Type :
Out_Id [ INTEGER ] primary_key
Out_Name [ TEXT ]
Wicket_Taken :
Match_Id [ INTEGER ] Wicket_Taken.Match_Id = Match.Match_Id
Over_Id [ INTEGER ]
Ball_Id [ INTEGER ]
Player_Out [ INTEGER ] Wicket_Taken.Player_Out = Player.Player_Id
Kind_Out [ INTEGER ] Wicket_Taken.Kind_Out = ... | SELECT SUM(CASE WHEN T1.Innings_No = 2 THEN 1 ELSE 0 END) FROM Wicket_Taken AS T1 INNER JOIN Out_Type AS T2 ON T2.Out_Id = T1.Kind_Out WHERE T2.Out_Name = 'stumped'; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT SUM(CASE WHEN T2.Player_Name = 'Yuvraj Singh' THEN 1 ELSE 0 END) FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match; |
[INST] Here is a database schema:
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling... | SELECT T2.Player_Name, T2.DOB FROM Country AS T1 INNER JOIN Player AS T2 ON T2.Country_Name = T1.Country_Id WHERE T2.DOB LIKE '1977%' AND T1.Country_Name = 'England'; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T1.Player_Name FROM Player AS T1 INNER JOIN Match AS T2 ON T2.Man_of_the_Match = T1.Player_Id INNER JOIN Season AS T3 ON T3.Season_Id = T2.Season_Id WHERE T3.Season_Year = 2010 GROUP BY T1.Player_Name; |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEG... | SELECT CAST(SUM(CASE WHEN T1.Match_Winner = 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Match_Id) FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_1 INNER JOIN Team AS T3 ON T3.Team_Id = T1.Team_2 WHERE T2.Team_Name = 'Chennai Super Kings' OR T3.Team_Name = 'Chennai Super Kings'; |
[INST] Here is a database schema:
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling... | SELECT T4.Player_Name, T5.Country_Name FROM Player_Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_Id INNER JOIN Match AS T3 ON T3.Match_Id = T1.Match_Id INNER JOIN Player AS T4 ON T4.Player_Id = T1.Player_Id INNER JOIN Country AS T5 ON T5.Country_Id = T4.Country_Name WHERE T2.Team_Name = 'Gujarat Lions' AND ... |
[INST] Here is a database schema:
Bowling_Style :
Bowling_Id [ INTEGER ] primary_key
Bowling_skill [ TEXT ]
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.... | SELECT T1.Player_Name, T1.DOB FROM Player AS T1 INNER JOIN Bowling_Style AS T2 ON T2.Bowling_Id = T1.Bowling_skill WHERE T2.Bowling_skill = 'Left-arm fast'; |
[INST] Here is a database schema:
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Umpire :
Umpire_Id [ INTEGER ] primary_key
Umpire_Name [ TEXT ]
Umpire_Country [ INTEGER ] Umpire.Umpire_Country = Country.Country_Id
Please write me a SQL statement that answers the following question: Where did BR Do... | SELECT T1.Country_Name FROM Country AS T1 INNER JOIN Umpire AS T2 ON T2.Umpire_Country = T1.Country_Id WHERE T2.Umpire_Name = 'BR Doctrove'; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T3.Player_Name FROM Player_Match AS T1 INNER JOIN Match AS T2 ON T2.Match_Id = T1.Match_Id INNER JOIN Player AS T3 ON T3.Player_Id = T1.Player_Id INNER JOIN Rolee AS T4 ON T4.Role_Id = T1.Role_Id WHERE T2.Match_Date = '2008-06-01' AND T4.Role_Desc = 'Captain' AND T2.Match_Winner = T1.Team_Id; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T3.Team_Name, COUNT(T2.Match_Id) FROM Player AS T1 INNER JOIN Player_Match AS T2 ON T2.Player_Id = T1.Player_Id INNER JOIN Team AS T3 ON T3.Team_Id = T2.Team_Id WHERE T1.Player_Name = 'CK Kapugedera'; |
[INST] Here is a database schema:
City :
City_Id [ INTEGER ] primary_key
City_Name [ TEXT ]
Country_id [ INTEGER ]
Venue :
Venue_Id [ INTEGER ] primary_key
Venue_Name [ TEXT ]
City_Id [ INTEGER ] Venue.City_Id = City.City_Id
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 ... | SELECT CAST(SUM(CASE WHEN T2.Venue_Name = 'Wankhede Stadium' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.Match_Id) FROM City AS T1 INNER JOIN Venue AS T2 ON T2.City_Id = T1.City_Id INNER JOIN Match AS T3 ON T3.Venue_Id = T2.Venue_Id WHERE T1.City_Name = 'Mumbai'; |
[INST] Here is a database schema:
Out_Type :
Out_Id [ INTEGER ] primary_key
Out_Name [ TEXT ]
Wicket_Taken :
Match_Id [ INTEGER ] Wicket_Taken.Match_Id = Match.Match_Id
Over_Id [ INTEGER ]
Ball_Id [ INTEGER ]
Player_Out [ INTEGER ] Wicket_Taken.Player_Out = Player.Player_Id
Kind_Out [ INTEGER ] Wicket_Taken.Kind_Out = ... | SELECT CAST(SUM(CASE WHEN T2.Out_Name = 'bowled' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.Player_Out) FROM Wicket_Taken AS T1 INNER JOIN Out_Type AS T2 ON T2.Out_Id = T1.Kind_Out WHERE T1.Match_Id = 392187; |
[INST] Here is a database schema:
Toss_Decision :
Toss_Id [ INTEGER ] primary_key
Toss_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_I... | SELECT CAST(SUM(CASE WHEN T2.Toss_Name = 'field' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Toss_Id) FROM Match AS T1 INNER JOIN Toss_Decision AS T2 ON T2.Toss_Id = T1.Toss_Decide WHERE T1.Match_Date BETWEEN '2010-01-01' AND '2016-12-31'; |
[INST] Here is a database schema:
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEGER ] Match.Venue_Id = Venue.Venue_Id
Toss_Winner [ INTEGER... | SELECT Toss_Winner FROM Match WHERE Toss_Decide = 2; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T1.Match_Id FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match WHERE T2.Player_Name = 'BB McCullum'; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT T2.DOB FROM Match AS T1 INNER JOIN Player AS T2 ON T2.Player_Id = T1.Man_of_the_Match; |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEG... | SELECT T2.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Toss_Winner WHERE T1.Match_Id BETWEEN 336010 AND 336020; |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEG... | SELECT SUM(CASE WHEN T2.Team_Name = 'Mumbai Indians' THEN 1 ELSE 0 END) FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Match_Winner; |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEG... | SELECT T2.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Team_2 WHERE T1.Team_1 = ( SELECT Team_Id FROM Team WHERE Team_Name = 'Pune Warriors' ) GROUP BY T2.Team_Name; |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEG... | SELECT T2.Team_Name FROM Match AS T1 INNER JOIN Team AS T2 ON T2.Team_Id = T1.Match_Winner WHERE T1.Match_Id = 336000; |
[INST] Here is a database schema:
Venue :
Venue_Id [ INTEGER ] primary_key
Venue_Name [ TEXT ]
City_Id [ INTEGER ] Venue.City_Id = City.City_Id
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ]... | SELECT T1.Match_Id FROM Match AS T1 INNER JOIN Venue AS T2 ON T2.Venue_Id = T1.Venue_Id WHERE T2.Venue_Name = 'Brabourne Stadium'; |
[INST] Here is a database schema:
Venue :
Venue_Id [ INTEGER ] primary_key
Venue_Name [ TEXT ]
City_Id [ INTEGER ] Venue.City_Id = City.City_Id
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ]... | SELECT T2.Venue_Name FROM Match AS T1 INNER JOIN Venue AS T2 ON T2.Venue_Id = T1.Venue_Id WHERE T1.Season_Id = 2 GROUP BY T2.Venue_Name; |
[INST] Here is a database schema:
City :
City_Id [ INTEGER ] primary_key
City_Name [ TEXT ]
Country_id [ INTEGER ]
Venue :
Venue_Id [ INTEGER ] primary_key
Venue_Name [ TEXT ]
City_Id [ INTEGER ] Venue.City_Id = City.City_Id
Please write me a SQL statement that answers the following question: What is the city of M Chi... | SELECT T1.City_Name FROM City AS T1 INNER JOIN Venue AS T2 ON T2.City_Id = T1.City_Id WHERE T2.Venue_Name = 'M Chinnaswamy Stadium'; |
[INST] Here is a database schema:
City :
City_Id [ INTEGER ] primary_key
City_Name [ TEXT ]
Country_id [ INTEGER ]
Venue :
Venue_Id [ INTEGER ] primary_key
Venue_Name [ TEXT ]
City_Id [ INTEGER ] Venue.City_Id = City.City_Id
Please write me a SQL statement that answers the following question: List down all of the venu... | SELECT T2.Venue_Name FROM City AS T1 INNER JOIN Venue AS T2 ON T2.City_Id = T1.City_Id WHERE T1.City_Name = 'Mumbai'; |
[INST] Here is a database schema:
Venue :
Venue_Id [ INTEGER ] primary_key
Venue_Name [ TEXT ]
City_Id [ INTEGER ] Venue.City_Id = City.City_Id
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ]... | SELECT T2.Match_Winner FROM Venue AS T1 INNER JOIN Match AS T2 ON T1.Venue_Id = T2.Venue_Id WHERE T1.Venue_Name LIKE 'St George%'; |
[INST] Here is a database schema:
City :
City_Id [ INTEGER ] primary_key
City_Name [ TEXT ]
Country_id [ INTEGER ]
Venue :
Venue_Id [ INTEGER ] primary_key
Venue_Name [ TEXT ]
City_Id [ INTEGER ] Venue.City_Id = City.City_Id
Please write me a SQL statement that answers the following question: Is SuperSport Park locate... | SELECT T2.City_Name FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_Id = T2.City_Id WHERE T1.Venue_Name LIKE 'St George%'; |
[INST] Here is a database schema:
Team :
Team_Id [ INTEGER ] primary_key
Team_Name [ TEXT ]
Match :
Match_Id [ INTEGER ] primary_key
Team_1 [ INTEGER ] Match.Team_1 = Team.Team_Id
Team_2 [ INTEGER ] Match.Team_2 = Team.Team_Id
Match_Date [ DATE ]
Season_Id [ INTEGER ] Match.Season_Id = Season.Season_Id
Venue_Id [ INTEG... | SELECT SUM(T2.Match_Winner) FROM Team AS T1 INNER JOIN Match AS T2 ON T1.Team_Id = T2.Match_Winner WHERE T1.Team_Name = 'Deccan Chargers'; |
[INST] Here is a database schema:
City :
City_Id [ INTEGER ] primary_key
City_Name [ TEXT ]
Country_id [ INTEGER ]
Venue :
Venue_Id [ INTEGER ] primary_key
Venue_Name [ TEXT ]
City_Id [ INTEGER ] Venue.City_Id = City.City_Id
Please write me a SQL statement that answers the following question: Count the total venues lo... | SELECT SUM(T1.Venue_Name) FROM Venue AS T1 INNER JOIN City AS T2 ON T1.City_Id = T2.City_Id WHERE T2.City_Name = 'Pune'; |
[INST] Here is a database schema:
Ball_by_Ball :
Match_Id [ INTEGER ] Ball_by_Ball.Match_Id = Match.Match_Id
Over_Id [ INTEGER ]
Ball_Id [ INTEGER ]
Innings_No [ INTEGER ]
Team_Batting [ INTEGER ]
Team_Bowling [ INTEGER ]
Striker_Batting_Position [ INTEGER ]
Striker [ INTEGER ]
Non_Striker [ INTEGER ]
Bowler [ INTEGER ... | SELECT Ball_Id FROM Ball_by_Ball WHERE Non_Striker = Ball_Id ORDER BY Ball_Id DESC LIMIT 1; |
[INST] Here is a database schema:
Batsman_Scored :
Match_Id [ INTEGER ] Batsman_Scored.Match_Id = Match.Match_Id
Over_Id [ INTEGER ]
Ball_Id [ INTEGER ]
Runs_Scored [ INTEGER ]
Innings_No [ INTEGER ]
Please write me a SQL statement that answers the following question: Calculate the average runs scored during the first... | SELECT CAST(SUM(CASE WHEN 1 < Over_Id AND Over_Id < 25 THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(Runs_Scored) FROM Batsman_Scored WHERE Innings_No = 1; |
[INST] Here is a database schema:
Extra_Runs :
Match_Id [ INTEGER ]
Over_Id [ INTEGER ]
Ball_Id [ INTEGER ]
Extra_Type_Id [ INTEGER ] Extra_Runs.Extra_Type_Id = Extra_Type.Extra_Id
Extra_Runs [ INTEGER ]
Innings_No [ INTEGER ]
Please write me a SQL statement that answers the following question: What are the average ex... | SELECT AVG(Innings_No) FROM Extra_Runs WHERE Innings_No = 2; |
[INST] Please write me a SQL statement that answers the following question: Among the matches, what percentage have a winning margin above 100? [/INST] [/INST] | SELECT CAST(COUNT(CASE WHEN Win_Margin > 100 THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(Match_Id) FROM `Match`; |
[INST] Here is a database schema:
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.Bowling_Id
Country_Name [ INTEGER ] Player.Country_Name = Country.Country_... | SELECT Player_Name FROM Player WHERE DOB BETWEEN '1970-01-01' AND '1990-12-31' ORDER BY DOB DESC; |
[INST] Here is a database schema:
Wicket_Taken :
Match_Id [ INTEGER ] Wicket_Taken.Match_Id = Match.Match_Id
Over_Id [ INTEGER ]
Ball_Id [ INTEGER ]
Player_Out [ INTEGER ] Wicket_Taken.Player_Out = Player.Player_Id
Kind_Out [ INTEGER ] Wicket_Taken.Kind_Out = Out_Type.Out_Id
Fielders [ INTEGER ] Wicket_Taken.Fielders =... | SELECT SUM(CASE WHEN Fielders = '' THEN 1 ELSE 0 END) FROM Wicket_Taken WHERE Over_Id = 3; |
[INST] Here is a database schema:
Country :
Country_Id [ INTEGER ] primary_key
Country_Name [ TEXT ]
Umpire :
Umpire_Id [ INTEGER ] primary_key
Umpire_Name [ TEXT ]
Umpire_Country [ INTEGER ] Umpire.Umpire_Country = Country.Country_Id
Please write me a SQL statement that answers the following question: From which coun... | SELECT T2.Country_Id, COUNT(T1.Umpire_Id) FROM Umpire AS T1 INNER JOIN Country AS T2 ON T2.Country_Id = T1.Umpire_Country GROUP BY T2.Country_Id ORDER BY COUNT(T1.Umpire_Id) DESC LIMIT 1; |
[INST] Here is a database schema:
Rolee :
Role_Id [ INTEGER ] primary_key
Role_Desc [ TEXT ]
Player_Match :
Match_Id [ INTEGER ] Player_Match.Match_Id = Match.Match_Id
Player_Id [ INTEGER ] Player_Match.Player_Id = Player.Player_Id
Role_Id [ INTEGER ] Player_Match.Role_Id = Rolee.Role_Id
Team_Id [ INTEGER ] Player_Matc... | SELECT CAST(SUM(CASE WHEN T2.Role_Desc = 'CaptainKeeper' THEN 1 ELSE 0 END) AS REAL) * 100 / TOTAL(T1.Player_Id) FROM Player_Match AS T1 INNER JOIN Rolee AS T2 ON T1.Role_Id = T2.Role_Id; |
[INST] Here is a database schema:
Out_Type :
Out_Id [ INTEGER ] primary_key
Out_Name [ TEXT ]
Wicket_Taken :
Match_Id [ INTEGER ] Wicket_Taken.Match_Id = Match.Match_Id
Over_Id [ INTEGER ]
Ball_Id [ INTEGER ]
Player_Out [ INTEGER ] Wicket_Taken.Player_Out = Player.Player_Id
Kind_Out [ INTEGER ] Wicket_Taken.Kind_Out = ... | SELECT Player_Out FROM Wicket_Taken AS T1 INNER JOIN Out_Type AS T2 ON T1.Kind_Out = T2.Out_Id WHERE Out_Name = 'hit wicket'; |
[INST] Here is a database schema:
Batting_Style :
Batting_Id [ INTEGER ] primary_key
Batting_hand [ TEXT ]
Player :
Player_Id [ INTEGER ] primary_key
Player_Name [ TEXT ]
DOB [ DATE ]
Batting_hand [ INTEGER ] Player.Batting_hand = Batting_Style.Batting_Id
Bowling_skill [ INTEGER ] Player.Bowling_skill = Bowling_Style.B... | SELECT CAST(SUM(CASE WHEN T1.Batting_hand = 'Right-hand bat' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.Country_Name) FROM Batting_Style AS T1 INNER JOIN Player AS T2 ON T1.Batting_id = T2.Batting_hand; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.