IPL Insights is a comprehensive database project that captures the rich history of the Indian Premier League (IPL) from its inception in 2008 to 2024. This project aims to provide in-depth analysis and insights into match statistics, player performances, and team dynamics throughout the seasons.
To analyze IPL data to derive insights on team performances, player statistics, and match outcomes, enabling data-driven decision-making for fans and analysts.
The dataset consists of two key tables:
- Matches: Contains details about each match.
- Deliveries: Captures detailed information for each delivery bowled in the matches.
dataset link: (https://www.kaggle.com/datasets/patrickb1912/ipl-complete-dataset-20082020).
Here are some of the key SQL queries used to analyze the data:
SELECT COUNT(*) AS total_matches FROM matches;
```sql
SELECT winner,
COUNT(*) AS matches_won
FROM matches
GROUP BY winner;
```
```sql
SELECT player_of_match,
COUNT(*) AS awards_count
FROM matches
GROUP BY player_of_match
ORDER BY awards_count DESC LIMIT 1;
```
```sql
SELECT m.season,
AVG(match_runs.total_runs) AS average_runs
FROM matches m
JOIN (SELECT match_id, SUM(batsman_runs) AS total_runs FROM
deliveries GROUP BY match_id) AS match_runs
ON m.id = match_runs.match_id
GROUP BY m.season
ORDER BY m.season;
```
```sql
SELECT batting_team,
MAX(total_runs) AS highest_score
FROM (SELECT match_id, SUM(batsman_runs) AS total_runs,
batting_team FROM deliveries
GROUP BY match_id, batting_team) AS match_totals
GROUP BY batting_team ORDER BY highest_score DESC LIMIT 1;
```
```sql
SELECT dismissal_kind, COUNT(*) AS frequency
FROM deliveries WHERE is_wicket = 1
GROUP BY dismissal_kind ORDER BY frequency DESC;
```
```sql
SELECT batter, SUM(batsman_runs) AS total_runs
FROM deliveries
GROUP BY batter ORDER BY total_runs DESC;
```
```sql
SELECT COUNT(*) AS no_result_matches
FROM matches
WHERE result = 'no result';
```
```sql
SELECT AVG(CASE WHEN over <= 6 THEN batsman_runs ELSE 0 END) AS
average_powerplay_runs, AVG;
```
```sql
SELECT COUNT(*) AS matches_won_by_wickets
FROM matches
WHERE result = 'wickets';
```
```sql
SELECT season, winner, COUNT(*) AS wins
FROM matches
GROUP BY season, winner
HAVING COUNT(*) = (SELECT MAX(wins)
FROM ( SELECT winner, COUNT(*) AS wins FROM matches
WHERE season = m.season GROUP BY winner ) AS season_wins)
FROM matches m ORDER BY season;
```
Compare the top 5 players with the highest runs scored in the first half of matches (first 10 overs)
```sql
SELECT batter, SUM(batsman_runs) AS total_runs
FROM deliveries
WHERE over <= 10
GROUP BY batter;
```
ORDER BY total_runs DESC LIMIT 5;```