Skip to content

Instantly share code, notes, and snippets.

@lfy79001
Created May 13, 2024 00:27
Show Gist options
  • Save lfy79001/7da31d4a8c5a76f6dcb37f3b96977935 to your computer and use it in GitHub Desktop.
Save lfy79001/7da31d4a8c5a76f6dcb37f3b96977935 to your computer and use it in GitHub Desktop.
SELECT
SEASON_ID-20000 AS season,
TEAM_ID_HOME AS team_id,
TEAM_NAME_HOME AS team_name,
FG3_PCT_HOME AS three_point_percentage,
COUNT(TEAM_ID_HOME) AS team_game_count,
"home" AS game_location
FROM Game
GROUP BY SEASON_ID, TEAM_ID_HOME
UNION
SELECT
SEASON_ID-20000 AS season,
TEAM_ID_AWAY AS team_id,
TEAM_NAME_AWAY AS team_name,
FG3_PCT_AWAY AS three_point_percentage,
COUNT(TEAM_ID_AWAY) AS team_game_count,
"away" AS game_location
FROM Game
GROUP BY SEASON_ID, TEAM_ID_AWAY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment