{"question": "What is the average height of NBA players who are 25 years old or older", "sql": "SELECT AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) AS average_height FROM nba_roster WHERE CAST(AGE AS INTEGER) >= 25;"}
{"question": "Which team has the most players who attended the University of Michigan", "sql": "SELECT team, COUNT(*) AS num_players FROM nba_roster WHERE COLLEGE = 'Michigan' GROUP BY team ORDER BY num_players DESC LIMIT 1;"}
{"question": "What is the most common position in the NBA", "sql": "SELECT POS, COUNT(*) as count FROM nba_roster GROUP BY POS ORDER BY count DESC LIMIT 1;"}
{"question": "What is the average age of all players in the NBA", "sql": "SELECT AVG(AGE) FROM nba_roster;"}
{"question": "What position has the most players aged 30 or older in the NBA", "sql": "SELECT POS, COUNT(*) AS count FROM nba_roster WHERE AGE >= 30 GROUP BY POS ORDER BY count DESC LIMIT 1;"}
{"question": "What is the age of the oldest 25% of the players in the NBA", "sql": "SELECT CAST(AGE AS INTEGER) AS percentile FROM nba_roster ORDER BY percentile LIMIT 1 OFFSET (SELECT COUNT(*) FROM nba_roster) * 75/100 - 1;"}
{"question": "What is the average age of players at each position in the NBA", "sql": "SELECT POS, AVG(AGE) AS avg_age FROM nba_roster GROUP BY POS;"}
{"question": "What is the position with the highest average salary in the NBA", "sql": "SELECT POS, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) AS avg_salary FROM nba_roster GROUP BY POS ORDER BY avg_salary DESC LIMIT 1;"}
{"question": "What is the average age of the youngest players in the NBA", "sql": "SELECT AVG(AGE) as avg_age FROM nba_roster WHERE AGE <= 25;"}
{"question": "What is the team with the highest average salary in the NBA", "sql": "SELECT TEAM, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as avg_salary FROM nba_roster WHERE SALARY!= '--' GROUP BY TEAM ORDER BY avg_salary DESC LIMIT 1;"}
{"question": "Who are the top 5 most valuable players in the NBA, considering both their salary and jersey number", "sql": "SELECT name, (CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) + CAST(Jersey AS INTEGER)) AS total_value, POS FROM nba_roster WHERE SALARY!= '--' ORDER BY total_value DESC LIMIT 5;"}
{"question": "Which three teams in the NBA have the highest average salary", "sql": "SELECT team, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) AS avg_salary FROM nba_roster WHERE SALARY!= '--' GROUP BY team ORDER BY avg_salary DESC LIMIT 3;"}
{"question": "How many players in the NBA are more than 5 years older than the average age of all players", "sql": "SELECT COUNT(*) FROM nba_roster WHERE AGE - (SELECT AVG(AGE) FROM nba_roster) > 5;"}
{"question": "What is the position with the oldest average age in the NBA", "sql": "SELECT POS, AVG(AGE) as avg_age FROM nba_roster GROUP BY POS ORDER BY avg_age DESC LIMIT 1;"}
{"question": "Which 10 teams in the NBA have the oldest average age among their players", "sql": "SELECT Team, AVG(AGE) AS avg_age FROM nba_roster GROUP BY Team ORDER BY avg_age DESC LIMIT 10;"}
{"question": "Who is the tallest player in the NBA", "sql": "SELECT NAME, AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) as height FROM nba_roster GROUP BY NAME ORDER BY height DESC LIMIT 1;"}
{"question": "Who are the top 5 highest-paid players in the NBA", "sql": "SELECT NAME, SALARY FROM nba_roster WHERE SALARY!= '--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 5;"}
{"question": "How many players in the NBA are older than 10 years old", "sql": "SELECT COUNT(*) AS num_players FROM nba_roster WHERE AGE > 10;"}
{"question": "What are the top 3 colleges with the highest average salaries for their NBA players", "sql": "SELECT COLLEGE, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as average_salary FROM nba_roster WHERE COLLEGE!= '--' GROUP BY COLLEGE ORDER BY average_salary DESC LIMIT 3;"}
{"question": "What is the 75th percentile salary in the NBA", "sql": "SELECT (SELECT CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) as percentile FROM nba_roster WHERE SALARY!= '--' ORDER BY percentile ASC LIMIT 1 OFFSET (SELECT COUNT(*) FROM nba_roster WHERE SALARY!= '--')*75/100-1) as seventy_fifth_percentile_salary;"}
{"question": "What is the average age of players on each NBA team", "sql": "SELECT TEAM, AVG(AGE) as average_age FROM nba_roster GROUP BY TEAM ORDER BY average_age;"}
{"question": "What is the average age of the players on the Toronto Raptors", "sql": "SELECT AVG(AGE) FROM nba_roster WHERE team='Toronto Raptors';"}
{"question": "What is the age range of players on each team in the NBA", "sql": "SELECT team, MIN(AGE) as youngest_player, MAX(AGE) as oldest_player FROM nba_roster GROUP BY team;"}
{"question": "What are the min and max salaries for each team", "sql": "SELECT MIN(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as min_salary, MAX(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as max_salary, team FROM nba_roster WHERE SALARY!= '--' GROUP BY team ORDER BY min_salary DESC, max_salary DESC;"}
{"question": "What is the name of the player who attended the college with the longest name", "sql": "SELECT NAME, COLLEGE FROM nba_roster WHERE COLLEGE!= '--' ORDER BY LENGTH(COLLEGE) DESC LIMIT 1;"}
{"question": "What is the number of players on each team in the NBA", "sql": "SELECT Team, COUNT(*) as num_players FROM nba_roster GROUP BY Team;"}
{"question": "What is the most represented college in the NBA", "sql": "SELECT COLLEGE, COUNT(*) AS frequency FROM nba_roster WHERE COLLEGE!= '--' GROUP BY COLLEGE ORDER BY frequency DESC LIMIT 1;"}
{"question": "How many Boston Celtics players did not attend college", "sql": "SELECT COUNT(*) as count FROM nba_roster WHERE team='Boston Celtics' AND COLLEGE!='--';"}
{"question": "What is the team with the highest average age in the NBA", "sql": "SELECT AVG(AGE) as average_age, TEAM FROM nba_roster GROUP BY TEAM ORDER BY average_age DESC LIMIT 1;"}
{"question": "What is the average salary of all players in the NBA, excluding those with a salary of '--'", "sql": "SELECT AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as average_salary FROM nba_roster WHERE SALARY!= '--';"}
{"question": "What is the average salary for players of each age group in the NBA, excluding those with unknown salaries", "sql": "SELECT AVG(AGE) AS avg_age, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) AS avg_salary FROM nba_roster WHERE SALARY!= '--' GROUP BY AGE ORDER BY avg_age;"}
{"question": "Who is the player with the highest jersey number in the NBA", "sql": "SELECT NAME, JERSEY FROM nba_roster WHERE JERSEY!= 'NA' ORDER BY JERSEY DESC LIMIT 1;"}
{"question": "What is the number of players on the Toronto Raptors", "sql": "SELECT COUNT(*) as num_players FROM nba_roster WHERE team='Toronto Raptors';"}
{"question": "What is the average age of all NBA players with a known salary", "sql": "SELECT AVG(AGE) FROM nba_roster WHERE SALARY!= '--';"}
{"question": "What is the position with the highest average age among players between the ages of 22 and 25", "sql": "SELECT AVG(AGE) AS avg_age, POS FROM nba_roster WHERE AGE BETWEEN 22 AND 25 GROUP BY POS ORDER BY avg_age DESC LIMIT 1;"}
{"question": "What are the top 5 positions in the NBA with the highest average salary", "sql": "SELECT POS, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as avg_salary FROM nba_roster GROUP BY POS ORDER BY avg_salary DESC LIMIT 5;"}
{"question": "What are the top 5 highest-paid players in the NBA", "sql": "SELECT * FROM nba_roster ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 5;"}
{"question": "Which player has the highest average salary in the NBA", "sql": "SELECT name, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as average_salary FROM nba_roster WHERE SALARY!= '--' GROUP BY name ORDER BY average_salary DESC LIMIT 1;"}
{"question": "Which team has the tallest players on average", "sql": "SELECT TEAM, AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) as average_height FROM nba_roster GROUP BY TEAM ORDER BY average_height DESC LIMIT 1;"}
{"question": "Who is the highest-paid player in the NBA who has attended a college with an unknown college affiliation", "sql": "SELECT NAME FROM nba_roster WHERE SALARY!= '--' AND COLLEGE = '--' ORDER BY CAST(SUBSTR(SALARY, 2) as INTEGER) DESC LIMIT 1;"}
{"question": "What is the average age and salary for each position in the NBA", "sql": "SELECT POS, AVG(AGE) as avg_age, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as avg_salary FROM nba_roster GROUP BY POS;"}
{"question": "What is the number of unique colleges represented in the NBA", "sql": "SELECT COUNT(DISTINCT COLLEGE) FROM nba_roster WHERE COLLEGE!= '--';"}
{"question": "Which team has the oldest average age among all NBA teams", "sql": "SELECT team, AVG(AGE) AS average_age FROM nba_roster GROUP BY team ORDER BY average_age DESC LIMIT 1;"}
{"question": "What is the highest-paid player on the Los Angeles Lakers", "sql": "SELECT salary, name FROM nba_roster WHERE team='Los Angeles Lakers' AND SALARY!= '--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',', '') AS INTEGER) DESC LIMIT 1;"}
{"question": "Which NBA team has the most players from the University of Michigan", "sql": "SELECT team, COUNT(*) AS num_players FROM nba_roster WHERE COLLEGE='Michigan' GROUP BY team ORDER BY num_players DESC LIMIT 1;"}
{"question": "What are the most common positions in the NBA", "sql": "SELECT POS, COUNT(*) as count FROM nba_roster GROUP BY POS ORDER BY count DESC;"}
{"question": "What are the top 5 teams with the highest average salary in the NBA", "sql": "SELECT team, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) AS average_salary FROM nba_roster GROUP BY team ORDER BY average_salary DESC LIMIT 5;"}
{"question": "How many NBA players attended a college other than '--'", "sql": "SELECT COUNT(*) FROM nba_roster WHERE COLLEGE!= '--';"}
{"question": "Who is the highest-paid player on the Memphis Grizzlies", "sql": "select name, team, salary from nba_roster where team='Memphis Grizzlies' and SALARY!='--' order by CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) desc limit 1;"}
{"question": "Which team has the highest average salary", "sql": "SELECT Team, AVG(CAST(SUBSTR(SALARY, 2, LENGTH(SALARY)-2) AS INTEGER)) as average_salary FROM nba_roster WHERE SALARY!= '--' GROUP BY Team ORDER BY average_salary DESC LIMIT 1;"}
{"question": "What college has the highest average age of its alumni in the NBA", "sql": "SELECT NAME, AVG(AGE) as average_age FROM nba_roster WHERE COLLEGE!= '--' GROUP BY COLLEGE ORDER BY average_age DESC LIMIT 1;"}
{"question": "Who is the highest-paid player in the NBA who has attended college", "sql": "SELECT NAME FROM nba_roster WHERE COLLEGE!= '--' AND SALARY!= '--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 1;"}
{"question": "Who is the highest-paid player in the NBA who is older than 25 years old", "sql": "SELECT name, salary FROM nba_roster WHERE AGE > 25 AND SALARY!= '--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 1;"}
{"question": "What is the average salary for each age group in the NBA", "sql": "SELECT AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as average_salary, AGE as age_group FROM nba_roster GROUP BY AGE;"}
{"question": "What is the most common age and position combination in the NBA", "sql": "SELECT AGE, POS, COUNT(*) AS count FROM nba_roster GROUP BY AGE, POS ORDER BY count DESC;"}
{"question": "Who are the top 5 players with the highest jersey numbers in the NBA", "sql": "SELECT NAME, Jersey FROM nba_roster WHERE Jersey IN (SELECT Jersey FROM nba_roster ORDER BY CAST(CAST(Jersey AS INTEGER) AS INTEGER) DESC LIMIT 5);"}
{"question": "What is the average height of players in the NBA who are 25 years old or younger", "sql": "SELECT AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)) AS avg_height FROM nba_roster WHERE AGE <= 25;"}
{"question": "What are the top 5 highest-paid players in each position in the NBA", "sql": "WITH ranked_positions AS (SELECT *, DENSE_RANK() OVER (PARTITION BY POS ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC) AS rank FROM nba_roster) SELECT * FROM ranked_positions WHERE rank <= 5;"}
{"question": "How many players in the NBA are older than 25 years old", "sql": "SELECT COUNT(*) as num_players FROM nba_roster WHERE AGE > 25;"}
{"question": "What is the most common position for players under the age of 25 in the NBA", "sql": "SELECT POS, COUNT(*) AS count FROM nba_roster WHERE AGE <= 25 GROUP BY POS ORDER BY count DESC LIMIT 1;"}
{"question": "Who is the player with the highest jersey number on the Golden State Warriors", "sql": "SELECT NAME FROM nba_roster WHERE TEAM = 'Golden State Warriors' AND CAST(Jersey AS INTEGER) = (SELECT MAX(CAST(Jersey AS INTEGER)) FROM nba_roster WHERE TEAM = 'Golden State Warriors');"}
{"question": "Which five teams in the NBA have the largest rosters", "sql": "SELECT Team, COUNT(*) as num_players FROM nba_roster GROUP BY Team ORDER BY num_players DESC LIMIT 5;"}
{"question": "What is the average salary for each position in the NBA, and which position has the highest average salary", "sql": "SELECT POS, AVG(CAST(SUBSTR(SALARY, 2) AS INTEGER)) as avg_salary FROM nba_roster WHERE SALARY!= '--' GROUP BY POS ORDER BY avg_salary DESC;"}
{"question": "Which team has the highest average salary in the NBA", "sql": "SELECT team, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as average_salary FROM nba_roster WHERE SALARY!= '--' GROUP BY team ORDER BY average_salary DESC LIMIT 1;"}
{"question": "Who is the oldest player in the NBA, on average, among those with known salaries", "sql": "SELECT NAME, AVG(AGE) as avg_age FROM nba_roster WHERE SALARY!= '--' GROUP BY NAME ORDER BY avg_age DESC LIMIT 1;"}
{"question": "What is the total salary of all players in the NBA who are 25 years old or younger", "sql": "SELECT SUM(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as total_salary FROM nba_roster WHERE AGE <= 25;"}
{"question": "Who is the second-highest paid player on the Memphis Grizzlies", "sql": "select name, team, salary from nba_roster where team='Memphis Grizzlies' and SALARY!= '--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 1 OFFSET 1;"}
{"question": "Who are the top 3 highest-paid players in the NBA", "sql": "SELECT * FROM (SELECT *, ROW_NUMBER() OVER (ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC) as row_num FROM nba_roster WHERE SALARY!= '--') AS subquery WHERE row_num <= 3;"}
{"question": "What is the average age of players for each team in the NBA", "sql": "SELECT team, AVG(AGE) AS avg_age FROM nba_roster GROUP BY team;"}
{"question": "How many Boston Celtics players have a salary greater than $5,000,000", "sql": "SELECT COUNT(*) as count FROM nba_roster WHERE team='Boston Celtics' AND CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) > 5000000;"}
{"question": "What is the average age of the players in the NBA roster", "sql": "SELECT AVG(AGE) as average_age FROM nba_roster;"}
{"question": "Who are the top 3 highest-paid players at each position in the NBA", "sql": "WITH ranked_positions AS (SELECT *, DENSE_RANK() OVER (PARTITION BY POS ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC) AS rank FROM nba_roster) SELECT * FROM ranked_positions WHERE rank <= 3;"}
{"question": "Who is the oldest player on the Toronto Raptors", "sql": "SELECT name, age FROM nba_roster WHERE team='Toronto Raptors' ORDER BY age DESC LIMIT 1;"}
{"question": "Which team has the oldest average age in the NBA", "sql": "SELECT Team, AVG(AGE) AS Average_Age FROM nba_roster GROUP BY Team ORDER BY Average_Age DESC LIMIT 1;"}
{"question": "What are the positions with the most players under the age of 25", "sql": "SELECT pos, COUNT(*) as num_players FROM nba_roster WHERE age < 25 GROUP BY pos;"}
{"question": "Who are the top 3 players in the NBA roster with the highest jersey numbers", "sql": "SELECT NAME, JERSEY FROM nba_roster ORDER BY JERSEY DESC LIMIT 3;"}
{"question": "What is the average height of the youngest players in the NBA", "sql": "SELECT AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) as height FROM nba_roster WHERE age <= 25;"}
{"question": "What is the oldest player in the NBA", "sql": "SELECT NAME FROM nba_roster WHERE AGE = (SELECT MAX(AGE) FROM nba_roster);"}
{"question": "What are the top 5 teams with the highest average salaries in the NBA", "sql": "SELECT team, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as average_salary FROM nba_roster WHERE SALARY!= '--' GROUP BY team ORDER BY average_salary DESC LIMIT 5;"}
{"question": "What is the highest-paid player on the same team as a Toronto Raptors player", "sql": "SELECT name, team, salary FROM nba_roster WHERE team IN (SELECT team FROM nba_roster WHERE name IN (SELECT name FROM nba_roster WHERE team='Toronto Raptors')) ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 1;"}
{"question": "Which teams have the most young players in the NBA", "sql": "SELECT team, COUNT(*) as num_players FROM nba_roster WHERE AGE < 25 GROUP BY team order by num_players desc;"}
{"question": "What is the position with the most players in the age range of 22-25 in the NBA", "sql": "SELECT POS, COUNT(*) AS count FROM nba_roster WHERE AGE BETWEEN 22 AND 25 GROUP BY POS ORDER BY count DESC LIMIT 1;"}
{"question": "What is the number of players in the NBA who are older than the average age of all players in the league", "sql": "SELECT COUNT(*) as num_players FROM nba_roster WHERE AGE > (SELECT AVG(AGE) FROM nba_roster);"}
{"question": "What is the most common position for young players in the NBA", "sql": "SELECT POS, COUNT(*) AS count FROM nba_roster WHERE AGE BETWEEN 22 AND 25 GROUP BY POS ORDER BY count DESC LIMIT 1;"}
{"question": "Which three teams in the NBA have the largest rosters", "sql": "SELECT Team, COUNT(*) as num_players FROM nba_roster GROUP BY Team ORDER BY num_players DESC LIMIT 3;"}
{"question": "What are the top 5 teams with the oldest average age of players", "sql": "SELECT Team, AVG(AGE) as average_age FROM nba_roster GROUP BY Team ORDER BY average_age DESC LIMIT 5;"}
{"question": "What age group has the most players in the NBA", "sql": "SELECT AGE, COUNT(*) as count FROM nba_roster GROUP BY AGE ORDER BY count DESC;"}
{"question": "What is the average age of players in each position in the NBA", "sql": "SELECT AVG(AGE) AS avg_age, POS FROM nba_roster GROUP BY POS ORDER BY avg_age;"}
{"question": "What are the top 3 highest-paid players from Duke University", "sql": "SELECT name, salary FROM nba_roster WHERE COLLEGE = 'Duke' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 3;"}
{"question": "Which team has the most non-point guards", "sql": "SELECT name, team FROM nba_roster WHERE team IN (SELECT team FROM nba_roster WHERE POS='PG' GROUP BY team HAVING COUNT(*) > 5 ORDER BY COUNT(*) DESC LIMIT 1) AND POS!= 'PG';"}
{"question": "Who is the player with the highest jersey number on the Boston Celtics", "sql": "SELECT NAME FROM nba_roster WHERE team='Boston Celtics' AND CAST(Jersey AS INTEGER) = (SELECT MAX(CAST(Jersey AS INTEGER)) FROM nba_roster WHERE team='Boston Celtics');"}
{"question": "Which teams have the most players aged 25 or older", "sql": "SELECT team, COUNT(*) as num_players FROM nba_roster WHERE age >= 25 GROUP BY team;"}
{"question": "How many players in the NBA are older than 20 years old", "sql": "SELECT COUNT(*) AS num_players FROM nba_roster WHERE age + (2022 - 2000) > 10;"}
{"question": "What is the average age and height of Power Forward players in the NBA", "sql": "SELECT AVG(CAST(SUBSTR(AGE, 1, INSTR(AGE,' ') - 1) AS INTEGER)) as average_age, AVG(CAST(SUBSTR(AGE, INSTR(AGE,' ') + 1) AS FLOAT)) as average_height FROM nba_roster WHERE POS = 'PF';"}
{"question": "Which team has the most players under the age of 36", "sql": "SELECT team, COUNT(*) FROM nba_roster WHERE AGE < 3*12 GROUP BY team ORDER BY COUNT(*) DESC LIMIT 1;"}
{"question": "What is the number of players under the age of 25 with known heights for each position in the NBA", "sql": "SELECT pos, COUNT(*) as num_players FROM nba_roster WHERE AGE < 25 AND HT!= 'NA' GROUP BY pos;"}
{"question": "What is the average salary of NBA players 25 years old or younger", "sql": "SELECT AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as average_salary FROM nba_roster WHERE AGE <= 25 AND SALARY!= '--';"}
{"question": "What is the most popular position in the NBA", "sql": "SELECT POS, COUNT(*) as count FROM nba_roster WHERE POS!= 'NA' GROUP BY POS ORDER BY count DESC LIMIT 1;"}
{"question": "What position has the most players earning a salary above the average salary in the NBA", "sql": "SELECT POS, COUNT(*) AS count FROM nba_roster WHERE CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) > (SELECT AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) FROM nba_roster) GROUP BY POS ORDER BY count DESC LIMIT 1;"}
{"question": "Which three teams in the NBA have the highest average salaries", "sql": "SELECT team, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as average_salary FROM nba_roster WHERE SALARY!= '--' GROUP BY team ORDER BY average_salary DESC LIMIT 3;"}
{"question": "Which five colleges have produced the most players in the NBA", "sql": "SELECT COLLEGE, COUNT(*) as count FROM nba_roster WHERE COLLEGE!= '--' GROUP BY COLLEGE ORDER BY count DESC LIMIT 5;"}
{"question": "Which teams have the most players who are at least 5 years older than the youngest player in the league", "sql": "SELECT team, COUNT(*) AS num_players FROM nba_roster WHERE age - (SELECT MIN(age) FROM nba_roster) > 5 GROUP BY team ORDER BY num_players DESC;"}
{"question": "Who are the Boston Celtics players aged 25 or older, listed in order of their jersey number", "sql": "SELECT name FROM nba_roster WHERE team='Boston Celtics' AND age>=25 ORDER BY CAST(Jersey AS INTEGER) ASC;"}
{"question": "What is the average salary of all NBA players who are 25 years or older", "sql": "SELECT AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) AS average_salary FROM nba_roster WHERE AGE >= 25;"}
{"question": "What is the highest-paid player on the Cleveland Cavaliers", "sql": "SELECT salary, name FROM nba_roster WHERE team='Cleveland Cavaliers' AND SALARY!= '--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 1;"}
{"question": "What is the highest-paid player on the Toronto Raptors", "sql": "SELECT name, salary FROM nba_roster WHERE team='Toronto Raptors' AND salary!= '--' ORDER BY CAST(REPLACE(REPLACE(salary, '$', ''), ',','') AS INTEGER) DESC LIMIT 1;"}
{"question": "What is the highest average salary for each position in the NBA", "sql": "SELECT POS, MAX(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) AS max_salary FROM nba_roster GROUP BY POS;"}
{"question": "What is the average salary of all NBA players, excluding those with unknown salaries", "sql": "SELECT AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) AS average_salary FROM nba_roster WHERE SALARY!= '--';"}
{"question": "Who is the youngest player on the Toronto Raptors", "sql": "SELECT NAME FROM nba_roster WHERE AGE = (SELECT MIN(AGE) FROM nba_roster WHERE TEAM = 'Toronto Raptors');"}
{"question": "What is the height of the 75th percentile of NBA players", "sql": "SELECT CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12 as percentile from nba_roster order by percentile limit 1 offset (SELECT COUNT(*) FROM nba_roster)*0.75;"}
{"question": "Who are the top 5 players in the NBA with the highest total value, considering both their salary and jersey number", "sql": "SELECT name, (CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) + CAST(Jersey AS INTEGER)) as total_value, POS FROM nba_roster WHERE SALARY!= '--' AND Jersey!= 'NA' ORDER BY total_value DESC LIMIT 5;"}
{"question": "Which colleges have more than one player in the NBA", "sql": "SELECT COLLEGE, COUNT(*) AS num_players FROM nba_roster GROUP BY COLLEGE HAVING COUNT(*) > 1;"}
{"question": "Who is the highest-paid guard on the Los Angeles Lakers", "sql": "SELECT name FROM nba_roster WHERE team='Los Angeles Lakers' AND POS='G' AND SALARY!='--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 1;"}
{"question": "Which players in the NBA are taller than 6'7", "sql": "SELECT name FROM nba_roster WHERE CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12 >= 6.67;"}
{"question": "What is the average height of all players in the NBA", "sql": "SELECT AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) as average_height from nba_roster;"}
{"question": "How many players on the Boston Celtics did not attend college", "sql": "SELECT COUNT(*) FROM nba_roster WHERE team='Boston Celtics' AND COLLEGE!='--';"}
{"question": "What is the team with the most players 30 or older in the NBA", "sql": "SELECT TEAM, COUNT(*) as num_players FROM nba_roster WHERE AGE >= 30 GROUP BY TEAM ORDER BY num_players DESC LIMIT 1;"}
{"question": "What are the top 10 most common positions in the NBA", "sql": "SELECT POS, COUNT(*) AS count FROM nba_roster GROUP BY POS ORDER BY count DESC LIMIT 10;"}
{"question": "What is the number of players on each team who earn more than $1,000,000 and the total number of players on each team", "sql": "SELECT team, COUNT(*) as num_players, SUM(CASE WHEN CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) > 1000000 THEN 1 ELSE 0 END) as num_players_above_1m FROM nba_roster WHERE SALARY!= '--' GROUP BY team;"}
{"question": "Who is the player with the highest average salary in the NBA", "sql": "SELECT name, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as average_salary FROM nba_roster WHERE SALARY!= '--' GROUP BY name ORDER BY average_salary DESC LIMIT 1;"}
{"question": "Who are the top 5 players in the NBA in terms of their total value, combining their salary and jersey number", "sql": "SELECT name, (CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) + CAST(Jersey AS INTEGER)) as total_value, POS FROM nba_roster WHERE SALARY!= '--' ORDER BY total_value DESC LIMIT 5;"}
{"question": "How many players are on the Toronto Raptors", "sql": "SELECT COUNT(*) FROM nba_roster WHERE team='Toronto Raptors';"}
{"question": "Which team has the most players over the age of 30", "sql": "SELECT Team, COUNT(*) as count FROM nba_roster WHERE CAST(AGE as INTEGER) > 30 GROUP BY Team ORDER BY count DESC LIMIT 1;"}
{"question": "What is the average height of point guards in the NBA", "sql": "SELECT AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)) as average_height FROM nba_roster WHERE POS='PG';"}
{"question": "What is the average salary of players in the NBA who are more than 5 years older than the average age of all players", "sql": "SELECT AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as average_salary FROM nba_roster WHERE AGE - (SELECT AVG(AGE) FROM nba_roster) > 5 AND SALARY!= '--';"}
{"question": "Which five teams in the NBA have the most players on their roster", "sql": "SELECT Team, COUNT(*) as num_players FROM nba_roster GROUP BY Team ORDER BY num_players DESC LIMIT 5;"}
{"question": "What college has produced the most NBA players", "sql": "SELECT COLLEGE, COUNT(*) as frequency FROM nba_roster GROUP BY COLLEGE ORDER BY frequency DESC LIMIT 1;"}
{"question": "What is the number of players in the NBA who are 25 years old or younger", "sql": "SELECT COUNT(*) AS num_players FROM nba_roster WHERE AGE <= 25;"}
{"question": "What are the top 5 players who have played the most seasons in each position in the NBA", "sql": "SELECT pos, name, COUNT(*) as seasons_played FROM nba_roster WHERE SALARY!= '--' GROUP BY pos, name ORDER BY seasons_played DESC LIMIT 5;"}
{"question": "What are the average salaries for each position in the NBA, and which positions have the highest average salaries", "sql": "SELECT POS, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) AS avg_salary FROM nba_roster GROUP BY POS ORDER BY avg_salary DESC;"}
{"question": "Which team has the most players who are significantly older than the average age of all NBA players", "sql": "SELECT team, COUNT(*) as num_players FROM nba_roster WHERE AGE - (SELECT AVG(AGE) FROM nba_roster) > 5 GROUP BY team ORDER BY num_players DESC LIMIT 1;"}
{"question": "What is the most common height range among NBA players under the age of 25", "sql": "SELECT HT, COUNT(*) as count FROM nba_roster WHERE AGE <= 25 GROUP BY HT ORDER BY count DESC LIMIT 1;"}
{"question": "What is the breakdown of players by position in the NBA", "sql": "SELECT POS, COUNT(*) as count FROM nba_roster GROUP BY POS;"}
{"question": "What are the top 3 teams in the NBA with the highest average salary", "sql": "SELECT team, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as average_salary FROM nba_roster GROUP BY team ORDER BY average_salary DESC LIMIT 3;"}
{"question": "What is the most common age range and position combination among NBA players", "sql": "SELECT age_range, POS, COUNT(*) AS count FROM (SELECT CASE WHEN AGE <= 25 THEN 'Young' WHEN AGE <= 30 THEN 'Established' ELSE 'Veteran' END AS age_range, POS FROM nba_roster) AS subquery GROUP BY age_range, POS ORDER BY count DESC LIMIT 1;"}
{"question": "What is the team with the tallest average height in the NBA", "sql": "SELECT team, AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) as height from nba_roster group by team order by height desc limit 1;"}
{"question": "What is the number of the player with the highest jersey number in the NBA", "sql": "SELECT NAME, JERSEY FROM nba_roster ORDER BY CAST(JERSEY AS INTEGER) DESC LIMIT 1;"}
{"question": "How many players in the NBA are older than the sum of their jersey number and age", "sql": "SELECT COUNT(*) as num_players FROM nba_roster WHERE age + CAST(SUBSTR(Jersey, 1, INSTR(Jersey,' ')-1) AS INTEGER) > 5;"}
{"question": "How many players in the NBA are under the age of 25", "sql": "SELECT COUNT(*) AS under_25 FROM nba_roster WHERE AGE < 25;"}
{"question": "What are the top 5 teams in the NBA with the highest average salary", "sql": "SELECT Team, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) AS avg_salary FROM nba_roster GROUP BY Team ORDER BY avg_salary DESC LIMIT 5;"}
{"question": "What is the average age of players who attended the same college as Otto Porter Jr.", "sql": "SELECT COLLEGE, AVG(AGE) AS avg_age FROM nba_roster WHERE COLLEGE IN (SELECT COLLEGE FROM nba_roster WHERE NAME = 'Otto Porter Jr.') GROUP BY COLLEGE;"}
{"question": "How many players in the NBA are at least 5 years older than the youngest player in the league", "sql": "SELECT COUNT(*) as num_players FROM nba_roster WHERE AGE - (SELECT MIN(AGE) FROM nba_roster) > 5;"}
{"question": "How many players in the NBA are more than 5 years older than the average age of all players in the league", "sql": "SELECT COUNT(*) as num_players FROM nba_roster WHERE AGE - (SELECT AVG(AGE) FROM nba_roster) > 5;"}
{"question": "What is the average salary of the Toronto Raptors players", "sql": "SELECT AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) AS average_salary FROM nba_roster WHERE team='Toronto Raptors' AND SALARY!= '--';"}
{"question": "Who is the highest-paid player on the Los Angeles Lakers who attended college", "sql": "SELECT NAME FROM nba_roster WHERE TEAM = 'Los Angeles Lakers' AND COLLEGE!= '--' AND SALARY!= '--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 1;"}
{"question": "What is the position with the most players in the NBA", "sql": "SELECT POS, COUNT(*) AS count FROM nba_roster GROUP BY POS ORDER BY count DESC LIMIT 1;"}
{"question": "Who is the highest-paid player in the NBA, excluding those with unknown salaries", "sql": "SELECT NAME, SALARY FROM nba_roster WHERE SALARY = (SELECT MAX(SALARY) FROM nba_roster WHERE SALARY!= '--');"}
{"question": "What is the name and jersey number of the player with the highest jersey number in the NBA", "sql": "SELECT NAME, JERSEY FROM nba_roster WHERE JERSEY!= 'NA' ORDER BY CAST(JERSEY AS INTEGER) DESC LIMIT 1;"}
{"question": "What is the average age of the players in the NBA who are at least 6 feet 7 inches tall", "sql": "SELECT AVG(AGE) AS average_age FROM nba_roster WHERE CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12 >= 6.67;"}
{"question": "What is the average age of players in the NBA who have a total of 12 years of experience or less", "sql": "SELECT AVG(AGE) FROM nba_roster WHERE AGE * 12 * 5 <= (SELECT SUM(AGE * 12) FROM nba_roster);"}
{"question": "Which team has the most players from the University of Michigan", "sql": "SELECT team, COUNT(*) as count FROM nba_roster WHERE COLLEGE='Michigan' GROUP BY team ORDER BY count DESC LIMIT 1;"}
{"question": "Who is the tallest Power Forward in the NBA", "sql": "SELECT POS, NAME, MAX(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) AS max_height FROM nba_roster WHERE POS='PF';"}
{"question": "What is the average age for each position in the NBA", "sql": "SELECT pos, AVG(AGE) AS avg_age FROM nba_roster WHERE POS IN ('PG', 'SG', 'SF', 'PF', 'C') GROUP BY pos;"}
{"question": "How many players are currently on the Toronto Raptors", "sql": "SELECT COUNT(*) AS num_players FROM nba_roster WHERE team='Toronto Raptors';"}
{"question": "Which teams in the NBA have the oldest average age among their players", "sql": "SELECT TEAM, AVG(AGE) as avg_age FROM nba_roster WHERE SALARY!= '--' GROUP BY TEAM ORDER BY avg_age DESC;"}
{"question": "What is the distribution of players across different positions in the NBA", "sql": "SELECT POS, COUNT(*) as count FROM nba_roster GROUP BY POS;"}
{"question": "How many players in the NBA have been in the league for more than 10 years longer than the average age of all players", "sql": "SELECT COUNT(*) as long_tenured_players FROM nba_roster WHERE AGE > (SELECT AVG(AGE) FROM nba_roster) + 10;"}
{"question": "What is the average height of all NBA players", "sql": "SELECT AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) as INTEGER)) FROM nba_roster;"}
{"question": "Who is the oldest player from the University of Michigan to have played in the NBA", "sql": "SELECT NAME, MAX(AGE) as oldest FROM nba_roster WHERE COLLEGE='Michigan';"}
{"question": "What are the most common colleges represented in the NBA, excluding players who did not attend college or did not disclose their college information", "sql": "SELECT COLLEGE, COUNT(*) as num_players FROM nba_roster WHERE COLLEGE!= '--' GROUP BY COLLEGE;"}
{"question": "What is the average age of all NBA players who are older than 5 years old", "sql": "SELECT AVG(AGE) as average_age FROM nba_roster WHERE AGE > 5;"}
{"question": "Who are the top 5 oldest Point Guards in the NBA", "sql": "SELECT * FROM nba_roster WHERE POS='PG' AND AGE > 25 ORDER BY AGE DESC LIMIT 5;"}
{"question": "How many players in the NBA are older than 5 years old", "sql": "SELECT COUNT(*) FROM nba_roster WHERE age > 5;"}
{"question": "How many players in the NBA have had a longer career than the average player and attended a college other than '--'", "sql": "SELECT COUNT(*) AS num_players FROM nba_roster WHERE AGE - (SELECT AVG(AGE) FROM nba_roster) > 5 AND COLLEGE!= '--';"}
{"question": "What are the top 5 colleges that have produced the most NBA players", "sql": "SELECT COLLEGE, COUNT(*) as num_players FROM nba_roster WHERE COLLEGE!= '--' GROUP BY COLLEGE ORDER BY num_players DESC LIMIT 5;"}
{"question": "Who is the highest-paid player on the Boston Celtics who plays either Small Forward or Power Forward", "sql": "SELECT name, salary FROM nba_roster WHERE team='Boston Celtics' AND (POS='SF' OR POS='PF' OR POS='SF/PF') AND SALARY!= '--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 1;"}
{"question": "What is the number of players in the NBA who attended a college other than '--'?", "sql": "SELECT COUNT(*) AS num_players FROM nba_roster WHERE COLLEGE!= '--';"}
{"question": "How many young players in the NBA are earning a salary", "sql": "SELECT COUNT(*) as young_players FROM nba_roster WHERE AGE <= 25 AND SALARY!= '--';"}
{"question": "Who are the top 3 players with the highest total value in the NBA", "sql": "SELECT name, team, (CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) + CAST(Jersey AS INTEGER)) AS total_value FROM nba_roster WHERE SALARY!= '--' AND Jersey!= 'NA' ORDER BY total_value DESC LIMIT 3;"}
{"question": "What is the average age of players on each team in the NBA, excluding those with unknown salaries", "sql": "SELECT team, AVG(AGE) AS average_age FROM nba_roster WHERE SALARY!= '--' GROUP BY team ORDER BY average_age ASC;"}
{"question": "Which team has the most players who attended college", "sql": "SELECT TEAM, COUNT(*) as num_players FROM nba_roster WHERE COLLEGE!= '--' GROUP BY TEAM ORDER BY num_players DESC LIMIT 1;"}
{"question": "What is the average age and maximum salary for each position in the NBA", "sql": "SELECT pos, AVG(AGE) as avg_age, MAX(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as max_salary FROM nba_roster WHERE SALARY!= '--' GROUP BY POS;"}
{"question": "How many players in the NBA are 25 years old or younger", "sql": "SELECT COUNT(*) FROM nba_roster WHERE AGE <= 25;"}
{"question": "What are the top 5 players in the NBA in terms of salary-to-age ratio", "sql": "SELECT NAME, CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) as salary, AGE FROM nba_roster WHERE SALARY!= '--' ORDER BY (CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)/AGE) DESC LIMIT 5;"}
{"question": "What are the top 3 players with the highest jersey numbers who are not Point Guards", "sql": "SELECT jersey, name FROM nba_roster WHERE pos!= 'PG' ORDER BY CAST(Jersey AS INTEGER) DESC LIMIT 3;"}
{"question": "What is the most common college attended by NBA players", "sql": "SELECT COLLEGE, COUNT(*) AS frequency FROM nba_roster GROUP BY COLLEGE ORDER BY frequency DESC LIMIT 1;"}
{"question": "Who is the tallest player in the league who plays either point guard, shooting guard, or small forward", "sql": "SELECT NAME, HT FROM nba_roster WHERE POS IN ('PG', 'SG', 'SF') ORDER BY HT DESC LIMIT 1;"}
{"question": "What is the average salary of NBA players who attended the University of Michigan", "sql": "SELECT COLLEGE, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as average_salary FROM nba_roster WHERE COLLEGE='Michigan' GROUP BY COLLEGE;"}
{"question": "What is the tallest team in the NBA", "sql": "SELECT team, AVG(CAST(SUBSTR(HT, 1, INSTR(HT,'')) AS INTEGER)) AS average_height FROM nba_roster GROUP BY team ORDER BY average_height DESC LIMIT 1;"}
{"question": "What is the average height and age of NBA players", "sql": "SELECT AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER) + CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) as height, AVG(CAST(AGE AS INTEGER)) as age FROM nba_roster;"}
{"question": "What positions have more than 5 years of experience compared to the average age of all players in the NBA", "sql": "SELECT POS, COUNT(*) as num_players FROM nba_roster WHERE AGE - (SELECT AVG(AGE) FROM nba_roster) > 5 GROUP BY POS;"}
{"question": "What is the second-highest paid player in the NBA", "sql": "SELECT name FROM nba_roster WHERE SALARY!= '--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 1 OFFSET (SELECT COUNT(*) FROM nba_roster WHERE SALARY!= '--') - 1;"}
{"question": "What is the average age of the youngest power forward in the NBA", "sql": "SELECT AVG(AGE) AS avg_age, CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12 AS height FROM nba_roster WHERE POS='PF' GROUP BY height ORDER BY avg_age ASC LIMIT 1;"}
{"question": "What are the top 5 highest-paid players for each position in the NBA", "sql": "WITH ranked_positions AS (SELECT *, DENSE_RANK() OVER (PARTITION BY POS ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC) as rank FROM nba_roster WHERE SALARY!= '--') SELECT * FROM ranked_positions WHERE rank <= 5;"}
{"question": "What is the tallest player on each team in the NBA", "sql": "SELECT team, MAX(HT), name as max_height FROM nba_roster WHERE HT!= 'NA' GROUP BY team;"}
{"question": "What is the position with the oldest players in the NBA", "sql": "SELECT POS, AVG(AGE) AS avg_age FROM nba_roster GROUP BY POS ORDER BY avg_age DESC LIMIT 1;"}
{"question": "What is the average height of the players in the Boston Celtics", "sql": "SELECT AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER) + CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) AS average_height FROM nba_roster WHERE team='Boston Celtics';"}
{"question": "How many Los Angeles Lakers players did not attend college", "sql": "SELECT COUNT(*) AS num_players FROM nba_roster WHERE team='Los Angeles Lakers' AND COLLEGE!='--';"}
{"question": "What is the average salary of players on the Toronto Raptors who are 25 years or older", "sql": "SELECT AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) AS average_salary FROM nba_roster WHERE team='Toronto Raptors' AND age>=25 AND SALARY!= '--';"}
{"question": "Which teams have the most players under the age of 25", "sql": "SELECT team, COUNT(*) as num_players FROM nba_roster WHERE AGE < 25 GROUP BY team ORDER BY num_players DESC;"}
{"question": "What are the average height and average salary for each team in the NBA", "sql": "SELECT team, AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) as avg_height, AVG(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as avg_salary FROM nba_roster GROUP BY team;"}
{"question": "Who are the top 5 players in the NBA with the highest jersey numbers", "sql": "SELECT NAME, JERSEY FROM nba_roster WHERE JERSEY!= 'NA' ORDER BY CAST(JERSEY AS INTEGER) DESC LIMIT 5;"}
{"question": "Who is the highest-paid player from the University of Michigan in the NBA", "sql": "select name, salary from nba_roster where college='Michigan' and SALARY!= '--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 1;"}
{"question": "What is the average age and height of players for each team in the NBA", "sql": "SELECT AVG(AGE) as avg_age, AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) as avg_height, TEAM FROM nba_roster GROUP BY TEAM;"}
{"question": "What is the average age and height of players on teams with more than 5 players in the NBA", "sql": "SELECT TEAM, AVG(AGE) as avg_age, AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) as avg_height FROM nba_roster GROUP BY TEAM HAVING COUNT(*) > 5;"}
{"question": "What is the average height of NBA players by age group", "sql": "SELECT AGE, AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) AS avg_height FROM nba_roster GROUP BY AGE;"}
{"question": "What is the average age of NBA players who play as Point Guard or Shooting Guard", "sql": "SELECT AVG(AGE) as average_age FROM nba_roster WHERE POS = 'PG' OR POS = 'SG' OR POS = 'PG/SG' OR POS = 'SG/PG';"}
{"question": "Who are the top 4 highest-paid players in the NBA", "sql": "SELECT POS, NAME, CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) as salary FROM nba_roster ORDER BY salary DESC LIMIT 5 OFFSET 0;"}
{"question": "Who is the highest-paid player on the Boston Celtics who did not attend college", "sql": "SELECT NAME FROM nba_roster WHERE team='Boston Celtics' AND COLLEGE!='--' AND SALARY=(SELECT MAX(SALARY) FROM nba_roster WHERE team='Boston Celtics' AND COLLEGE!='--');"}
{"question": "What is the average age of players in the NBA who are taller than 6 feet 7 inches", "sql": "SELECT AVG(AGE) FROM nba_roster WHERE CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER) + CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12 > 6.67;"}
{"question": "What is the 99th percentile salary in the NBA?", "sql": "SELECT (CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as percentile FROM nba_roster WHERE SALARY!= '--' order by percentile limit 1 offset (select count(*) from nba_roster where SALARY != '--')*99/100-1;"}
{"question": "What is the 75th percentile salary in the NBA?", "sql": "SELECT (CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as percentile FROM nba_roster WHERE SALARY!= '--' order by percentile limit 1 offset (select count(*) from nba_roster where SALARY != '--')*75/100-1;"}
{"question": "What is the 25th percentile salary in the NBA?", "sql": "SELECT (CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as percentile FROM nba_roster WHERE SALARY!= '--' order by percentile limit 1 offset (select count(*) from nba_roster where SALARY != '--')*25/100-1;"}
{"question": "What is the median weight in the NBA?", "sql": "select CAST(SUBSTR(WT, 1, INSTR(WT,' ')) as INTEGER) as percentile from nba_roster order by percentile limit 1 offset (select count(*) from nba_roster)/2;"}
{"question": "What is the average weight in the NBA?", "sql": "SELECT AVG(CAST(SUBSTR(WT, 1, INSTR(WT,' ')) as INTEGER)) FROM nba_roster;"}
{"question": "What is the median height in the NBA?", "sql": "select CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12 as percentile from nba_roster order by percentile limit 1 offset (select count(*) from nba_roster)/2;"}
{"question": "What is the average height in the NBA?", "sql": "select AVG(CAST(SUBSTR(HT, 1, INSTR(HT,' ')-1) AS INTEGER)+ CAST(SUBSTR(HT, INSTR(HT,' ')+1) AS FLOAT)/12) as height from nba_roster;"}
{"question": "Can you tell me how many players are in the NBA?", "sql": "select count(*) from nba_roster;"}
{"question": "Would you please let me know what the highest paid players are for each position?", "sql": "SELECT name, pos, MAX(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as max_salary FROM nba_roster WHERE SALARY!= '--' GROUP BY POS;"}
{"question": "Is Jalen Johnson 23 years old?", "sql": "Select name, age from nba_roster where name='Jalen Johnson';"}
{"question": "Who is the oldest player on the Brooklyn Nets?", "sql": "SELECT NAME FROM nba_roster WHERE TEAM = 'Brooklyn Nets' AND AGE = (SELECT MAX(AGE) FROM nba_roster WHERE TEAM = 'Brooklyn Nets');"}
{"question": "Who has the higest salary on the Memphis Grizzlies?", "sql": "select salary, name from nba_roster where team='Memphis Grizzlies' and SALARY!= '--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 1;"}
{"question": "Which player has the higest salary on the Cleveland Cavaliers?", "sql": "select salary, name from nba_roster where team='Cleveland Cavaliers' and SALARY!= '--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 1;"}
{"question": "Who is the highest paid center on the Dallas Mavericks?", "sql": "select salary, name from nba_roster where team='Dallas Mavericks' and POS='C' and SALARY!= '--' ORDER BY CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER) DESC LIMIT 1;"}
{"question": "How much is Marcus Smart getting paid?", "sql": "select salary from nba_roster where name='Marcus Smart';"}
{"question": "What's the average age of the Trail Blazers?", "sql": "select avg(age) from nba_roster where team='Portland Trail Blazers';"}
{"question": "What's the median age of the NBA?", "sql": "select CAST(AGE as INTEGER) as percentile from nba_roster order by percentile limit 1 offset (select count(*) from nba_roster)/2;"}
{"question": "What's the median age of the Miami Heat?", "sql": "select CAST(AGE as INTEGER) as percentile from nba_roster where team='Miami Heat' order by percentile limit 1 offset (select count(*) from nba_roster where team='Miami Heat')/2;"}
{"question": "What are the 5 teams with the oldest average age in the NBA", "sql": "SELECT team, AVG(AGE) AS average_age FROM nba_roster GROUP BY team ORDER BY average_age DESC LIMIT 5;"}
{"question": "What is the average salary of Power Forward players in the NBA", "sql": "select avg(CAST(REPLACE(REPLACE(SALARY, '$', ''), ',','') AS INTEGER)) as average_salary from nba_roster where POS = 'PF';"}
