| /* | |
| { | |
| "qid": "026", | |
| "task_type": "ambig", | |
| "has_intended_resolution": true, | |
| "language": "SQLite", | |
| "db": "professional_basketball", | |
| "question": "For each team that Marcus Williams played for, compute his aggregate field goal percentage.", | |
| "gold_ambiguity_points": [ | |
| { | |
| "id": "A", | |
| "phrase": "Marcus Williams", | |
| "type": "finite", | |
| "ambiguity_type": "semantic_value", | |
| "interpretations": [ | |
| "Marcus Williams from University of Connecticut born in 1985", | |
| "Marcus Williams from University of Arizona born in 1986" | |
| ], | |
| "intended_interpretation_idx": 0 | |
| }, | |
| { | |
| "id": "B", | |
| "phrase": "aggregate field goal percentage", | |
| "type": "finite", | |
| "ambiguity_type": "semantic_computation", | |
| "interpretations": [ | |
| "total FG%", | |
| "average season FG%" | |
| ], | |
| "intended_interpretation_idx": 1 | |
| }, | |
| { | |
| "id": "C", | |
| "phrase": "field goal percentage", | |
| "type": "finite", | |
| "ambiguity_type": "semantic_column", | |
| "interpretations": [ | |
| "regular season only", | |
| "playoff only", | |
| "regular season and playoff" | |
| ], | |
| "intended_interpretation_idx": 0 | |
| } | |
| ], | |
| "gold_intended_query_id": "GQRY-A.0-B.1-C.0", | |
| "extra_info": {} | |
| } | |
| */ | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.0-C.0` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.0-C.0", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 1, | |
| 2 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Marcus Williams": "Marcus Williams from University of Connecticut born in 1985", | |
| "[B] field goal percentage": "regular season only", | |
| "[C] aggregate field goal percentage": "total FG%" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT | |
| t.tmID, | |
| t.name, | |
| CASE | |
| WHEN SUM(pt.fgAttempted) = 0 THEN 0 | |
| ELSE CAST(SUM(pt.fgMade) AS REAL) / SUM(pt.fgAttempted) | |
| END as field_goal_percentage | |
| FROM players_teams pt | |
| JOIN players p ON pt.playerID = p.playerID | |
| JOIN teams t ON pt.tmID = t.tmID AND pt.year = t.year | |
| WHERE p.firstName = 'Marcus' | |
| AND p.lastName = 'Williams' | |
| AND p.college = 'Connecticut' | |
| AND p.birthDate = '1985-12-03' | |
| GROUP BY t.tmID, t.name; | |
| /* EXEC RESULT | |
| tmID name field_goal_percentage | |
| GSW Golden State Warriors 0.235294 | |
| MEM Memphis Grizzlies 0.383764 | |
| NJN New Jersey Nets 0.389769 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.0-C.1` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.0-C.1", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 1, | |
| 2 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Marcus Williams": "Marcus Williams from University of Connecticut born in 1985", | |
| "[B] field goal percentage": "playoff only", | |
| "[C] aggregate field goal percentage": "total FG%" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT | |
| t.tmID, | |
| t.name, | |
| CASE | |
| WHEN SUM(pt.PostfgAttempted) = 0 THEN 0 | |
| ELSE CAST(SUM(pt.PostfgMade) AS REAL) / SUM(pt.PostfgAttempted) | |
| END as field_goal_percentage | |
| FROM players_teams pt | |
| JOIN players p ON pt.playerID = p.playerID | |
| JOIN teams t ON pt.tmID = t.tmID AND pt.year = t.year | |
| WHERE p.firstName = 'Marcus' | |
| AND p.lastName = 'Williams' | |
| AND p.college = 'Connecticut' | |
| AND p.birthDate = '1985-12-03' | |
| GROUP BY t.tmID, t.name; | |
| /* EXEC RESULT | |
| tmID name field_goal_percentage | |
| GSW Golden State Warriors 0.000000 | |
| MEM Memphis Grizzlies 0.000000 | |
| NJN New Jersey Nets 0.333333 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.0-C.2` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.0-C.2", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 1, | |
| 2 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Marcus Williams": "Marcus Williams from University of Connecticut born in 1985", | |
| "[B] field goal percentage": "regular season and playoff", | |
| "[C] aggregate field goal percentage": "total FG%" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT | |
| t.tmID, | |
| t.name, | |
| CASE | |
| WHEN SUM(pt.PostfgAttempted) + SUM(pt.fgAttempted) = 0 THEN 0 | |
| ELSE CAST(SUM(pt.PostfgMade) + SUM(pt.fgMade) AS REAL) / (SUM(pt.PostfgAttempted) + SUM(pt.fgAttempted)) | |
| END as field_goal_percentage | |
| FROM players_teams pt | |
| JOIN players p ON pt.playerID = p.playerID | |
| JOIN teams t ON pt.tmID = t.tmID AND pt.year = t.year | |
| WHERE p.firstName = 'Marcus' | |
| AND p.lastName = 'Williams' | |
| AND p.college = 'Connecticut' | |
| AND p.birthDate = '1985-12-03' | |
| GROUP BY t.tmID, t.name; | |
| /* EXEC RESULT | |
| tmID name field_goal_percentage | |
| GSW Golden State Warriors 0.235294 | |
| MEM Memphis Grizzlies 0.383764 | |
| NJN New Jersey Nets 0.387398 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.1-C.0` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.1-C.0", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 1, | |
| 2 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Marcus Williams": "Marcus Williams from University of Connecticut born in 1985", | |
| "[B] field goal percentage": "regular season only", | |
| "[C] aggregate field goal percentage": "average season FG%" | |
| } | |
| } | |
| } | |
| */ | |
| WITH season_stats AS ( | |
| SELECT t.tmID, t.name, pt.year, | |
| CASE WHEN SUM(pt.fgAttempted) = 0 THEN 0 | |
| ELSE CAST(SUM(pt.fgMade) AS REAL) / SUM(pt.fgAttempted) | |
| END as field_goal_percentage | |
| FROM players_teams pt | |
| JOIN players p ON pt.playerID = p.playerID | |
| JOIN teams t ON pt.tmID = t.tmID AND pt.year = t.year | |
| WHERE p.firstName = 'Marcus' | |
| AND p.lastName = 'Williams' | |
| AND p.college = 'Connecticut' | |
| AND p.birthDate = '1985-12-03' | |
| GROUP BY t.tmID, t.name, pt.year | |
| ) | |
| SELECT tmID, name, AVG(field_goal_percentage) as field_goal_percentage | |
| FROM season_stats | |
| GROUP BY tmID, name; | |
| /* EXEC RESULT | |
| tmID name field_goal_percentage | |
| GSW Golden State Warriors 0.235294 | |
| MEM Memphis Grizzlies 0.383764 | |
| NJN New Jersey Nets 0.387549 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.1-C.1` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.1-C.1", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 1, | |
| 2 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Marcus Williams": "Marcus Williams from University of Connecticut born in 1985", | |
| "[B] field goal percentage": "playoff only", | |
| "[C] aggregate field goal percentage": "average season FG%" | |
| } | |
| } | |
| } | |
| */ | |
| WITH season_stats AS ( | |
| SELECT t.tmID, t.name, pt.year, | |
| CASE WHEN SUM(pt.PostfgAttempted) = 0 THEN 0 | |
| ELSE CAST(SUM(pt.PostfgMade) AS REAL) / SUM(pt.PostfgAttempted) | |
| END as field_goal_percentage | |
| FROM players_teams pt | |
| JOIN players p ON pt.playerID = p.playerID | |
| JOIN teams t ON pt.tmID = t.tmID AND pt.year = t.year | |
| WHERE p.firstName = 'Marcus' | |
| AND p.lastName = 'Williams' | |
| AND p.college = 'Connecticut' | |
| AND p.birthDate = '1985-12-03' | |
| GROUP BY t.tmID, t.name, pt.year | |
| ) | |
| SELECT tmID, name, AVG(field_goal_percentage) as field_goal_percentage | |
| FROM season_stats | |
| GROUP BY tmID, name; | |
| /* EXEC RESULT | |
| tmID name field_goal_percentage | |
| GSW Golden State Warriors 0.000000 | |
| MEM Memphis Grizzlies 0.000000 | |
| NJN New Jersey Nets 0.166667 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.0-B.1-C.2` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.0-B.1-C.2", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 1, | |
| 2 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Marcus Williams": "Marcus Williams from University of Connecticut born in 1985", | |
| "[B] field goal percentage": "regular season and playoff", | |
| "[C] aggregate field goal percentage": "average season FG%" | |
| } | |
| } | |
| } | |
| */ | |
| WITH season_stats AS ( | |
| SELECT t.tmID, t.name, pt.year, | |
| CASE WHEN SUM(pt.PostfgAttempted) + SUM(pt.fgAttempted) = 0 THEN 0 | |
| ELSE CAST(SUM(pt.PostfgMade) + SUM(pt.fgMade) AS REAL) / (SUM(pt.PostfgAttempted) + SUM(pt.fgAttempted)) | |
| END as field_goal_percentage | |
| FROM players_teams pt | |
| JOIN players p ON pt.playerID = p.playerID | |
| JOIN teams t ON pt.tmID = t.tmID AND pt.year = t.year | |
| WHERE p.firstName = 'Marcus' | |
| AND p.lastName = 'Williams' | |
| AND p.college = 'Connecticut' | |
| AND p.birthDate = '1985-12-03' | |
| GROUP BY t.tmID, t.name, pt.year | |
| ) | |
| SELECT tmID, name, AVG(field_goal_percentage) as field_goal_percentage | |
| FROM season_stats | |
| GROUP BY tmID, name; | |
| /* EXEC RESULT | |
| tmID name field_goal_percentage | |
| GSW Golden State Warriors 0.235294 | |
| MEM Memphis Grizzlies 0.383764 | |
| NJN New Jersey Nets 0.385560 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.0-C.0` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.0-C.0", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 1, | |
| 2 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Marcus Williams": "Marcus Williams from University of Arizona born in 1986", | |
| "[B] field goal percentage": "regular season only", | |
| "[C] aggregate field goal percentage": "total FG%" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT | |
| t.tmID, | |
| t.name, | |
| CASE | |
| WHEN SUM(pt.fgAttempted) = 0 THEN 0 | |
| ELSE CAST(SUM(pt.fgMade) AS REAL) / SUM(pt.fgAttempted) | |
| END as field_goal_percentage | |
| FROM players_teams pt | |
| JOIN players p ON pt.playerID = p.playerID | |
| JOIN teams t ON pt.tmID = t.tmID AND pt.year = t.year | |
| WHERE p.firstName = 'Marcus' | |
| AND p.lastName = 'Williams' | |
| AND p.college = 'Arizona' | |
| AND p.birthDate = '1986-11-18' | |
| GROUP BY t.tmID, t.name; | |
| /* EXEC RESULT | |
| tmID name field_goal_percentage | |
| LAC Los Angeles Clippers 0.263158 | |
| SAS San Antonio Spurs 0.666667 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.0-C.1` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.0-C.1", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 1, | |
| 2 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Marcus Williams": "Marcus Williams from University of Arizona born in 1986", | |
| "[B] field goal percentage": "playoff only", | |
| "[C] aggregate field goal percentage": "total FG%" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT | |
| t.tmID, | |
| t.name, | |
| CASE | |
| WHEN SUM(pt.PostfgAttempted) = 0 THEN 0 | |
| ELSE CAST(SUM(pt.PostfgMade) AS REAL) / SUM(pt.PostfgAttempted) | |
| END as field_goal_percentage | |
| FROM players_teams pt | |
| JOIN players p ON pt.playerID = p.playerID | |
| JOIN teams t ON pt.tmID = t.tmID AND pt.year = t.year | |
| WHERE p.firstName = 'Marcus' | |
| AND p.lastName = 'Williams' | |
| AND p.college = 'Arizona' | |
| AND p.birthDate = '1986-11-18' | |
| GROUP BY t.tmID, t.name; | |
| /* EXEC RESULT | |
| tmID name field_goal_percentage | |
| LAC Los Angeles Clippers 0 | |
| SAS San Antonio Spurs 0 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.0-C.2` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.0-C.2", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 1, | |
| 2 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Marcus Williams": "Marcus Williams from University of Arizona born in 1986", | |
| "[B] field goal percentage": "regular season and playoff", | |
| "[C] aggregate field goal percentage": "total FG%" | |
| } | |
| } | |
| } | |
| */ | |
| SELECT | |
| t.tmID, | |
| t.name, | |
| CASE | |
| WHEN SUM(pt.PostfgAttempted) + SUM(pt.fgAttempted) = 0 THEN 0 | |
| ELSE CAST(SUM(pt.PostfgMade) + SUM(pt.fgMade) AS REAL) / (SUM(pt.PostfgAttempted) + SUM(pt.fgAttempted)) | |
| END as field_goal_percentage | |
| FROM players_teams pt | |
| JOIN players p ON pt.playerID = p.playerID | |
| JOIN teams t ON pt.tmID = t.tmID AND pt.year = t.year | |
| WHERE p.firstName = 'Marcus' | |
| AND p.lastName = 'Williams' | |
| AND p.college = 'Arizona' | |
| AND p.birthDate = '1986-11-18' | |
| GROUP BY t.tmID, t.name; | |
| /* EXEC RESULT | |
| tmID name field_goal_percentage | |
| LAC Los Angeles Clippers 0.263158 | |
| SAS San Antonio Spurs 0.666667 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.1-C.0` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.1-C.0", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 1, | |
| 2 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Marcus Williams": "Marcus Williams from University of Arizona born in 1986", | |
| "[B] field goal percentage": "regular season only", | |
| "[C] aggregate field goal percentage": "average season FG%" | |
| } | |
| } | |
| } | |
| */ | |
| WITH season_stats AS ( | |
| SELECT t.tmID, t.name, pt.year, | |
| CASE WHEN SUM(pt.fgAttempted) = 0 THEN 0 | |
| ELSE CAST(SUM(pt.fgMade) AS REAL) / SUM(pt.fgAttempted) | |
| END as field_goal_percentage | |
| FROM players_teams pt | |
| JOIN players p ON pt.playerID = p.playerID | |
| JOIN teams t ON pt.tmID = t.tmID AND pt.year = t.year | |
| WHERE p.firstName = 'Marcus' | |
| AND p.lastName = 'Williams' | |
| AND p.college = 'Arizona' | |
| AND p.birthDate = '1986-11-18' | |
| GROUP BY t.tmID, t.name, pt.year | |
| ) | |
| SELECT tmID, name, AVG(field_goal_percentage) as field_goal_percentage | |
| FROM season_stats | |
| GROUP BY tmID, name; | |
| /* EXEC RESULT | |
| tmID name field_goal_percentage | |
| LAC Los Angeles Clippers 0.263158 | |
| SAS San Antonio Spurs 0.500000 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.1-C.1` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.1-C.1", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 1, | |
| 2 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Marcus Williams": "Marcus Williams from University of Arizona born in 1986", | |
| "[B] field goal percentage": "playoff only", | |
| "[C] aggregate field goal percentage": "average season FG%" | |
| } | |
| } | |
| } | |
| */ | |
| WITH season_stats AS ( | |
| SELECT t.tmID, t.name, pt.year, | |
| CASE WHEN SUM(pt.PostfgAttempted) = 0 THEN 0 | |
| ELSE CAST(SUM(pt.PostfgMade) AS REAL) / SUM(pt.PostfgAttempted) | |
| END as field_goal_percentage | |
| FROM players_teams pt | |
| JOIN players p ON pt.playerID = p.playerID | |
| JOIN teams t ON pt.tmID = t.tmID AND pt.year = t.year | |
| WHERE p.firstName = 'Marcus' | |
| AND p.lastName = 'Williams' | |
| AND p.college = 'Arizona' | |
| AND p.birthDate = '1986-11-18' | |
| GROUP BY t.tmID, t.name, pt.year | |
| ) | |
| SELECT tmID, name, AVG(field_goal_percentage) as field_goal_percentage | |
| FROM season_stats | |
| GROUP BY tmID, name; | |
| /* EXEC RESULT | |
| tmID name field_goal_percentage | |
| LAC Los Angeles Clippers 0.0 | |
| SAS San Antonio Spurs 0.0 | |
| */ | |
| ----- END OF GOLD QUERY ----- | |
| ----- START OF GOLD QUERY `GQRY-A.1-B.1-C.2` ----- | |
| /* | |
| { | |
| "id": "GQRY-A.1-B.1-C.2", | |
| "parameter_names": [], | |
| "parameter_values": {}, | |
| "other_exec_results": [], | |
| "required_columns": [ | |
| 1, | |
| 2 | |
| ], | |
| "required_sorted": false, | |
| "extra_info": { | |
| "ambiguity_resolution": { | |
| "[A] Marcus Williams": "Marcus Williams from University of Arizona born in 1986", | |
| "[B] field goal percentage": "regular season and playoff", | |
| "[C] aggregate field goal percentage": "average season FG%" | |
| } | |
| } | |
| } | |
| */ | |
| WITH season_stats AS ( | |
| SELECT t.tmID, t.name, pt.year, | |
| CASE WHEN SUM(pt.PostfgAttempted) + SUM(pt.fgAttempted) = 0 THEN 0 | |
| ELSE CAST(SUM(pt.PostfgMade) + SUM(pt.fgMade) AS REAL) / (SUM(pt.PostfgAttempted) + SUM(pt.fgAttempted)) | |
| END as field_goal_percentage | |
| FROM players_teams pt | |
| JOIN players p ON pt.playerID = p.playerID | |
| JOIN teams t ON pt.tmID = t.tmID AND pt.year = t.year | |
| WHERE p.firstName = 'Marcus' | |
| AND p.lastName = 'Williams' | |
| AND p.college = 'Arizona' | |
| AND p.birthDate = '1986-11-18' | |
| GROUP BY t.tmID, t.name, pt.year | |
| ) | |
| SELECT tmID, name, AVG(field_goal_percentage) as field_goal_percentage | |
| FROM season_stats | |
| GROUP BY tmID, name; | |
| /* EXEC RESULT | |
| tmID name field_goal_percentage | |
| LAC Los Angeles Clippers 0.263158 | |
| SAS San Antonio Spurs 0.500000 | |
| */ | |
| ----- END OF GOLD QUERY ----- |