Some queries topic that I thought-
Team
(Win (chase with wicket + defend with run, rain delay, total match, super over, most six by team,
most run by team, most wicket by team, most extra given by team, most 100 run scored by
player of team, most 50 by a team, most bold out perform by a team, most toss won by a team,
most consecutive wins 10 match streak of a all time group by season,)
Batter
(Most Six, most for, most run (with ball) , most legby, most strike rate in a season, best
innings(with ball in a match), best strike Rate in a match, batter with lowest dot ball in a match,
batter performance in powerplay-middle-death overs, consistent percentage of a season.)
Bowler
(Most wicket in a game and season and all time, most wide in a game and season, most no ball in
a game and season, and all time, most economical over in a game, most economical bowler in a
game and season and all time, most Lbw in a season and a game, most bold out in a game and
season and all time, most caught out in a game, most run concede in a game and season and all
time, economy in pressure in a season, bowler performances against high strikerate batters in a
match-season-all time, Most yorker in season match and all time )
Toss
(toss impact, win percentage of match after wining tos, lose percentage after winning toss)
Venu performances
(home advantages win rate, away win rate, home losing rate, away losing rate, most run scored in
a venue, most match played in a venue, most match rain delayed in a venue, most sixes in a
venue, least run scored in a venue) All of them are seasone and all time based.
Match result Trends
(win rate percentages by defending, win rate percentages by chasing, last ball boundery winning,
most run in powerplay, most run in death over.)
Team
(foreign vs domestic player performances in a match, season and all time(separate team), team
performances by season and all time.)
Tournaments
(Seasonal average run rats graph All time, Highest total in season and all time, lowest total in
season and all time, closest match ranked by season, best young player(Emergine player by
batting and bowling) in a season, best all rounder season and all time, most suceessfulll chases
200+ target.)
Record and Milestones
(Most tittles all time, most run scorer of all time, most wicket taker of all time, highest team
score, lowest team score, highest Individual scorer, fastest fifties& centuries, most sixes of all
time, most four all time, best strike rate of all time, Most win in chase, most win in defend, most
dot ball, most hattricks, most maiden overs, most catches of all time, biggest mergine wins, best
win percentage by a team group by season all time, longest unbeaten streak at home venue and in
a season and all time group by season, most run scored in a venue in seasone, most tied mathes&
super over win, most man of the matches, most stumping, most player of the tournament, most
direct hitting of all time, most runs + wicket of a all rounder in a seasons, Highest strike rates in
death over, most wicket taken by a player against a team,)
Core Tables
1. Matches
match_id (PK)
season_id (FK to Seasons)
venue_id (FK to Venues)
date
match_type (League, Playoff, Final, etc.)
team1_id (FK to Teams)
team2_id (FK to Teams)
toss_winner_id (FK to Teams)
toss_decision (bat/field)
match_winner_id (FK to Teams)
result (runs/wickets/super over/tie/no result)
result_margin
target_runs (if applicable)
target_overs (if applicable)
is_super_over (boolean)
super_over_method (if applicable)
umpire1_id (FK to Umpires)
umpire2_id (FK to Umpires)
player_of_match_id (FK to Players)
rain_delay_minutes (if applicable)
2. Seasons
season_id (PK)
year (e.g., "2007/08")
champion_team_id (FK to Teams)
runner_up_team_id (FK to Teams)
player_of_series_id (FK to Players)
most_runs_player_id (FK to Players)
most_wickets_player_id (FK to Players)
emerging_player_id (FK to Players)
3. Teams
team_id (PK)
team_name
short_name (e.g., "KKR")
home_venue_id (FK to Venues)
founded_year
owner
coach
captain_id (FK to Players)
4. Players
player_id (PK)
player_name
date_of_birth
batting_style (Right/Left handed)
bowling_style (e.g., "Right-arm fast")
country
is_active (boolean)
debut_match_id (FK to Matches)
retirement_date (if applicable)
5. Venues
venue_id (PK)
venue_name
city
country
capacity
pitch_type (e.g., "Batting friendly", "Spin friendly")
dimensions (boundary distances)
6. Umpires
umpire_id (PK)
umpire_name
country
matches_umpired
7. Deliveries (Ball-by-ball data)
delivery_id (PK)
match_id (FK to Matches)
inning (1 or 2)
batting_team_id (FK to Teams)
bowling_team_id (FK to Teams)
over
ball
batter_id (FK to Players)
non_striker_id (FK to Players)
bowler_id (FK to Players)
runs_batter
runs_extras
extra_type (wide, no ball, leg bye, bye, penalty)
total_runs
is_wicket (boolean)
wicket_type (bowled, caught, lbw, run out, stumped, etc.)
wicket_player_id (FK to Players - who got out)
dismissal_fielder_id (FK to Players - who took catch/effected runout)
is_boundary (boolean)
boundary_type (4 or 6)
is_dot_ball (boolean)
8. Player_Match_Stats
player_match_id (PK)
match_id (FK to Matches)
player_id (FK to Players)
team_id (FK to Teams)
runs_scored
balls_faced
fours
sixes
strike_rate
wickets_taken
runs_conceded
balls_bowled
economy
maidens_bowled
catches
stumpings
run_outs
9. Team_Season_Stats
team_season_id (PK)
team_id (FK to Teams)
season_id (FK to Seasons)
matches_played
matches_won
matches_lost
matches_tied
no_results
win_percentage
total_runs_scored
total_wickets_taken
total_sixes
total_fours
total_extras_given
highest_total
lowest_total
successful_chases
successful_defenses
10. Achievements
achievement_id (PK)
achievement_name (e.g., "Most Runs in a Season")
description
value (numeric value if applicable)
player_id (FK to Players, if individual)
team_id (FK to Teams, if team)
season_id (FK to Seasons, if seasonal)
match_id (FK to Matches, if match-specific)
date_achieved
View Tables (for common queries)
1. vw_top_batsmen - Top run scorers with strike rates
2. vw_top_bowlers - Top wicket takers with economies
3. vw_team_performance - Team win/loss records by season
4. vw_venue_stats - Performance metrics by venue
5. vw_toss_impact - Win percentages based on toss decisions
6. vw_powerplay_stats - Team/batter performance in powerplays
7. vw_death_over_stats - Team/batter performance in death overs
8. vw_player_consistency - Player performance consistency metrics
9. vw_allrounders - Best all-round performances
10. vw_milestones - Records and milestones achieved
Additional Tables to Consider
1. Partnerships - Track batting partnerships
2. Innings - Separate table for each innings in a match
3. Tournament_Stages - Group matches, playoffs, etc.
4. Player_Roles - Track player roles (batsman, bowler, all-rounder,
wicketkeeper)
5. Match_Events - Important events in a match (fall of wickets, strategic
timeouts)
6. Weather_Conditions - Track weather impact on matches
7. Team_Squads - Track which players were in which team each season
8. Awards - Track various awards given each season
This database design should support all the analysis topics you mentioned,
from team performance metrics to individual player statistics, venue
analysis, and tournament-wide trends. The views will help you quickly access
commonly needed aggregated data for your analysis
1. Powerplay_Death_Stats (For phase-wise analysis)
markdown
Copy
Download
- phase_id (PK)
- match_id (FK to Matches)
- inning (1 or 2)
- phase_type (Powerplay/Middle/Death)
- batting_team_id (FK to Teams)
- bowling_team_id (FK to Teams)
- runs_scored
- wickets_lost
- boundaries (4s + 6s)
- dot_balls
- economy_rate (for bowlers)
- strike_rate (for batters)
Purpose: Analyze team/player performance in specific match phases (e.g.,
"Most runs in death overs").
2. Super_Over_Details (For tie-breakers)
markdown
Copy
Download
- super_over_id (PK)
- match_id (FK to Matches)
- batting_team_id (FK to Teams)
- bowling_team_id (FK to Teams)
- runs_scored
- wickets_lost
- bowler_id (FK to Players)
- batter_id (FK to Players)
- is_winner (boolean)
Purpose: Track super over performances separately (aligned with your
query about "most super over wins").
3. Player_Against_Team (Head-to-head records)
markdown
Copy
Download
- record_id (PK)
- player_id (FK to Players)
- opponent_team_id (FK to Teams)
- matches_played
- runs_scored
- batting_avg
- wickets_taken
- bowling_avg
- strike_rate
- economy
Purpose: Answer queries like "Kohli's average vs MI" or "Bumrah's wickets
vs RCB".
4. Venue_Pitch_Report (For pitch behavior trends)
markdown
Copy
Download
- report_id (PK)
- venue_id (FK to Venues)
- season_id (FK to Seasons)
- pitch_type (Flat/Green/Spin-friendly)
- avg_first_innings_score
- avg_second_innings_score
- win_percentage_batting_first
- boundary_percentage
- spin_vs_pace_wicket_ratio
Purpose: Analyze venue-specific trends ("Is Wankhede a chasing ground?").
5. Streaks (For momentum analysis)
markdown
Copy
Download
- streak_id (PK)
- team_id (FK to Teams)
- season_id (FK to Seasons)
- streak_type (Win/Loss/Toss)
- start_date
- end_date
- streak_length
- is_active (boolean)
Purpose: Track "5-win streaks" or "10-toss wins" (aligned with your query
about "longest unbeaten streaks").
When to Stop Adding Tables?
1. Normalization Check: If you’re storing derived data (e.g.,
"total_runs" in Player_Match_Stats), avoid duplicate storage.
2. Query Patterns: Add tables only if they simplify complex queries
(e.g., Powerplay_Stats avoids filtering deliveries by over numbers
repeatedly).
3. Performance: If aggregations (like "total sixes in a season") are slow,
pre-compute them in summary tables.
Example Query Optimization
Without Powerplay_Stats:
sql
Copy
Download
SELECT SUM(runs) FROM deliveries
WHERE match_id IN (SELECT match_id FROM matches WHERE season_id=2019)
AND over <= 6;
With Powerplay_Stats:
sql
Copy
Download
SELECT SUM(runs_scored) FROM powerplay_stats
WHERE season_id=2019;
Recommendation: Implement these 5 tables first, then expand if needed
for niche analyses (e.g., Rain_Impact for weather-delayed matches). Your
current design covers ~90% of use cases!