Skip to content

Instantly share code, notes, and snippets.

@charles-tan
Created March 27, 2024 16:07
Show Gist options
  • Save charles-tan/5bfb7ae6c23459ced7c7e5ab53404b57 to your computer and use it in GitHub Desktop.
Save charles-tan/5bfb7ae6c23459ced7c7e5ab53404b57 to your computer and use it in GitHub Desktop.
CREATE MATERIALIZED VIEW player_wins AS
SELECT
player_id,
COUNT(*) AS games_played,
COUNT(CASE WHEN win = true THEN 1 END) AS games_won
FROM game_results
GROUP BY player_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment