Cricket Management System Final - Project Report
Cricket Management System Final - Project Report
MANAGEMENT
SYSTEM
By:
Karthik S (XII A9)
K S Shriram Kumar (XII A9)
Page 1 of 51
BONAFIDE CERTIFICATE
Certified that this project is a bonafide work of
Master/Miss__________________________________________
Roll No. of Class XII of Maharishi Vidya
Mandir Sr. Sec. School, Chetpet, Chennai during the year 2021
– 2022.
SEAL
Page 2 of 51
ACKNOWLEDGEMENT
Page 3 of 51
TABLE OF CONTENTS
3 Problem Definition 7
4 Problem Analysis 10
6 Source Code 14
8 Project Impact 36
10 Bibliography 38
Page 4 of 51
INTRODUCTION
India is a country where cricket is the most worshiped sport. Cricket in our country isn’t just
another sport but a religion. A religion that people devote so much of their time and energy to,
that it has paved way for different formats of the game like test matches, one day international
and Twenty20s. Due to the sport’s immense popularity, this arena has a lot of technological and
analytical opportunities. The Indian Premier League (IPL) is a professional Twenty20 cricket
league that has grabbed the attention of audience all over the globe. Right from choosing
players during auction to predicting teams in fantasy leagues, board members and cricket
lovers have always sought to leverage database management systems and streamline many
processes since the advent of technology.
It is this arena that we intend to capture via this project and build a database management
system (DBMS) to better manage and understand the abundance of data available for cricket
players while it comes to auctions, selections, and fantasy games.
Page 5 of 51
DATABASE MANAGEMENT SYSTEM
DBMS stands for "Database Management System." In short, a DBMS is a database program.
Technically speaking, it is a software system that uses a standard method of cataloging,
retrieving, and running queries on data. The DBMS manages incoming data, organizes it, and
provides ways for the data to be modified or extracted by users or other programs.
Some DBMS examples include MySQL, PostgreSQL, Microsoft Access, SQL Server, FileMaker,
Oracle, RDBMS, dBASE, Clipper, and FoxPro. Since there are so many database management
systems available, it is important for there to be a way for them to communicate with each
Page 6 of 51
other. For this reason, most database software comes with an Open Database Connectivity
(ODBC) driver that allows the database to integrate with other databases. For example,
common SQL statements such as SELECT and INSERT are translated from a program's
proprietary syntax into a syntax other databases can understand.
PROBLEM DEFINITION
The aim of this project is to provide complete end-to-end information about cricket players like
their batting/bowling averages, match history, experience and achievements along with their
personal details. A database management system is created with tables with player specific
fields and attributes like runs scored, wickets taken, strike rates, economy, nationality and
career-best figures. Using SQL, we query and arrive at our desired result through the following
process:
● The user is taken through a menu-driven program where he/she has to pick
specifics that might interest them in a good player
● After taking all of the user’s choices (mentioned previously) into consideration, a
list of most suited national or international players is shortlisted and the user is
notified
● The user can also take a look at the statistics and performance of any player in
the pool and can then base his decision to whether or not pick that player for his use
case
This project intends to help auctioneers make quick decisions. It also aids fantasy game
audiences to choose the best player for their team and accumulate points by assessing the
player’s profile, which further translates into rewards.
Page 7 of 51
Age, Nationality, Current team
PLAYER TYPE: Matches played
BATSMAN STATISTICS Preferred Batting Position
(PROFILE INFORMATION) Runs scored (T20)
Batting Average
Strike Rate
30+,50+,100+ scores
Page 8 of 51
Age, Nationality, Current team
PLAYER TYPE: Matches played
Page 9 of 51
PROBLEM ANALYSIS
All the necessary modules and libraries including the MySQL connector.
The landing page is a menu that requires the end user to specify if he is the owner of an IPL
team, a regular fantasy game player or an admin.
● 1- A cricket player
● 2- IPL Team Owner
● 3- Admin
Every user requires a username and password for access. For a first time user, username and
password is created by the admin. The user enters 1,2 or 3 and this choice is inputed.
1-Cricket Player
In case of option 1(Cricket Player), the user can enter his name and the following general stats
of that particular player are displayed using a search algorithm.
● Player Name
Page 10 of 51
● Nationality
● Age
● Current team
● Specialty (Batsman, Bowler, Allrounder or Wicketkeeper)
● Matches played
● Auction Price
If the user chooses the first option from the above list, then he is expected to enter the player
name of his choice and all the corresponding statistics of the player is displayed
If the user chooses the second option from the above list the user has to specify the statistics of
a player that interests them. A brief questionnaire is shown to users, and they fill in the
required information.
● Age
● Player Type (Batsman/Bowler/All Rounder)
Once the users enter their choices for the above queries, an implicit +/- 10 units is assigned to
all the parameters. For instance, if someone enters strike rate as 100, then an auto +/- range is
Page 11 of 51
assigned as it’ll be tough to have an accurate match. This would present a detailed list of
potential batsmen/bowler or all rounder and the user can then leverage it for his/her use case-
be it to form his/her fantasy league team or choosing a player to buy during auction.
3-Admin
If the user chooses option 3(Admin), then he is directed to a window where he chooses to:
a. Add a new player(s) information
b. Delete an existing player’s information
c. Modify an existing information
The above tasks are written as separate functions which are invoked as per the user’s
command.
Page 12 of 51
HARDWARE AND SOFTWARE REQUIREMENTS
8 GB
MEMORY
Page 13 of 51
FRONT END Python v 3.6.3
Page 14 of 51
SOURCE CODE
Page 15 of 51
else:
print("Please enter a given choice your choice was invalid")
import password
def Team_manager():
import mysql.connector as sql
import Player_search
connect = sql.connect(host="localhost", user="root", passwd="shriram123", database="sample")
cursor = connect.cursor()
password.password('team manager')
while True:
print('''Do you want to
1.Search for a specific player
2.Use stats to pick group of players''')
search = int(input("Enter '1'for choice 1 and '2' for choice 2:"))
if search == 1:
name = input("Enter a player name:")
st = "select speciality from players where playername='%s'"%(name,)
cursor.execute(st)
speciality = cursor.fetchone()
speciality = speciality[0]
if speciality == "AR":
st = '''select * from players,batsmen,bowlers
where players.playerid = batsmen.playerid
and batsmen.playerid = bowlers.playerid and playername = "%s"'''%(name,)
print('playername', 'nationality', 'age', 'current_team', 'speciality', 'no_matches', 'Price'
, sep='|', end="|")
print('avg_runs', 'strikerate', 'preffered_position', 'bestcore', 'Runs', '', sep='|', end="")
print("economy", "wicket taken", "bowling avg", 'bestfigure', 'Type', sep='|')
Page 16 of 51
cursor.execute(st)
for i in cursor:
for j in i[1:12]:
print(j, end="|")
for k in i[13:14]:
print(k, end="|")
for l in i[15:20]:
print(l, end="|")
print()
break
elif speciality == "batsmen" or "WK":
st = "select * from players,batsmen where players.playerid = batsmen.playerid and
playername ='%s'"%(name,)
print('playername', 'nationality', 'age', 'current_team', 'speciality', 'no_matches', "price"
, sep='|', end="")
print('avg_runs', 'strikerate', 'preffered_position', 'bestcore', 'runs', sep='|')
cursor.execute(st)
for i in cursor:
for j in i[1:12]:
print(j, end="|")
for k in i[13:14]:
print(k, end="|")
print("\b")
break
else:
st = "select * from bowlers,players where players.playerid = bowlers.playerid and playername
= '%s'"%(name,)
print('playername', 'nationality', 'age', 'current_team', 'speciality', 'no_matches', "price"
, sep='|', end="")
Page 17 of 51
print('avg_runs', 'strikerate', 'preffered_position', 'bestcore', 'runs', sep='|')
cursor.execute(st)
for i in cursor:
for j in i[1:12]:
print(j, end="|")
for k in i[13:14]:
print(k, end="|")
print("\b")
break
if search == 2:
Player_search.player_search()
break
def Admin():
import password
import mysql.connector as sql
connect = sql.connect(host="localhost", user="root", passwd="shriram123", database="sample")
cursor = connect.cursor()
password.password('Admin')
print('''Do you want to:
1.Add records
2.Modify records
3.Delete records''')
while True:
Action = input("Enter 'Add' or 'Modify' or 'Delete' to perform respective function:")
if Action == "Add":
while True:
import mysql.connector as sql
import Player_search
Page 18 of 51
connect = sql.connect(host="localhost", user="root", passwd="shriram123",
database="sample")
cursor = connect.cursor()
player_id = input("Enter character id:")
player_name = input("Enter name of player:")
age = int(input("Enter age:"))
current_team = input("Enter current team:")
nationality = input("Enter nationality:")
speciality = input("Enter speciality:")
no_matches = int(input("Enter no matches played:"))
password = input("Enter password for player:")
price = int(input("Enter Price:"))
stgeneral = 'insert into passwrd values("{0}","{1}","{2}","Player")'.format(player_id,player_name,
password)
cursor.execute(stgeneral)
if speciality == "Bowler":
economy = int(input("Enter economy:"))
wickets_taken = int(input("Enter wickets taken:"))
bowling_avg = int(input("Enter bowling avg:"))
bestfigure = int(input("Enter best figure:"))
Type = input("Enter Type:")
st = "insert into players values('{0}','{1}','{2}',{3},'{4}','{5}',{6},{7})".format(player_id,
player_name,nationality,age,current_team,speciality,no_matches,price)
stbowlinsert= "insert into bowlers values('{0}',{1},{2},{3},{4},'{5}')".format(player_id,economy
,wickets_taken,bowling_avg,bestfigure,Type)
cursor.execute(st)
cursor.execute(stbowlinsert)
connect.commit()
break
Page 19 of 51
elif speciality == 'batsmen':
avg_runs = int(input("Enter avg runs:"))
strikerate = int(input("Enter strike rate:"))
preffered_position = input("Enter Preffered position:")
bestscore = int(input("Enter bestscore:"))
runs = int(input("Enter Runs:"))
st = "insert into players values('{0}','{1}','{2}',{3},'{4}','{5}',{6},{7})".format(player_id,
player_name,
nationality,
age,
current_team,
speciality,
no_matches,price)
stbatsinsert = "insert into batsmen values({0},{1},'{2}',{3},'{4}',{5})".format(avg_runs,
strikerate,preffered_position,bestscore,player_id,runs)
cursor.execute(st)
cursor.execute(stbatsinsert)
connect.commit()
break
elif speciality == "AR":
avg_runs = int(input("Enter avg runs:"))
strikerate = int(input("Enter strike rate:"))
preffered_position = (input("Enter Preffered position:"))
bestscore = int(input("Enter bestscore:"))
economy = int(input("Enter economy:"))
wickets_taken = int(input("Enter wickets taken:"))
bowling_avg = int(input("Enter bowling avg:"))
Type = input("Enter Type:")
price = int(input("Enter price:"))
Page 20 of 51
runs = int(input("Enter Runs:"))
bestfigure = int(input("Enter best figure:"))
st = "insert into players values('{0}','{1}','{2}',{3},'{4}','{5}',{6},{7})".format(player_id,
player_name,
nationality,
age,
current_team,
speciality,
no_matches,price)
stbowlinsert = "insert into bowlers values('{0}',{1},{2},{3},{4},'{5}')".format(player_id, economy,
wickets_taken,
bowling_avg, bestfigure,Type)
stbatsinsert = "insert into batsmen values({0},{1},'{2}',{3},'{4}',{5})".format(avg_runs,
strikerate,
preffered_position,
bestscore,player_id,runs)
cursor.execute(st)
cursor.execute(stbowlinsert)
cursor.execute(stbatsinsert)
connect.commit()
break
else:
print("Incorrect speciality")
break
break
elif Action == "Modify":
while True:
import mysql.connector as sql
#import Player_search
Page 21 of 51
connect = sql.connect(host="localhost", user="root", passwd="shriram123",
database="sample")
cursor = connect.cursor()
player_id = input("Enter character id:")
st = "select speciality from players where playerid = '{0}'".format(player_id)
cursor.execute(st)
k = cursor.fetchone()
speciality = str(k[0])
if speciality == "Bowler":
economy = int(input("Enter economy:"))
wickets_taken = int(input("Enter wickets taken:"))
bowling_avg = int(input("Enter bowling avg:"))
bestfigure = int(input("Enter best figure:"))
Type = input("Enter Type:")
stbowlmodify= '''update bowlers
set economy = {0},wickets_taken = {1},bowling_avg = {2},bestfigure = {3},type_ = '{4}'
where playerid = "{5}"'''.format(economy,wickets_taken,bowling_avg,bestfigure,
Type,player_id)
cursor.execute(stbowlmodify)
connect.commit()
break
elif speciality == 'batsmen':
avg_runs = int(input("Enter avg runs:"))
strikerate = int(input("Enter strike rate:"))
preffered_position = input("Enter Preffered position:")
bestscore = int(input("Enter bestscore:"))
runs = int(input("Enter Runs:"))
stbatmodify= '''update batsmen
set avg_runs = {0},strikerate = {1},preffered_position = '{2}',bestscore = {3},runs ={4}
Page 22 of 51
where (playerid = '{5}')'''.format(avg_runs,strikerate,preffered_position,bestscore,runs,
player_id)
cursor.execute(stbatmodify)
connect.commit()
break
elif speciality == "AR":
avg_runs = int(input("Enter avg runs:"))
strikerate = int(input("Enter strike rate:"))
preffered_position = (input("Enter Preffered position:"))
bestscore = int(input("Enter bestscore:"))
Runs - int(input("Enter the Runs:"))
economy = int(input("Enter economy:"))
wickets_taken = int(input("Enter wickets taken:"))
bowling_avg = int(input("Enter bowling avg:"))
bestfigure = int(input("Enter best figure:"))
Type = input("Enter Bowling type 'Pace' or'spin':")
stbatmodify='''update batsmen
set avg_runs = {0},strikerate = {1},preffered_position = {2},runs = {5},bestscore = {3}
where (playerid = '{4}')'''.format(avg_runs,strikerate,preffered_position,bestscore,player_id,
Runs)
stbowlmodify = '''update bowlers
set economy = {0},wickets_taken = {1},bowling_avg = {2},bestfigure = {3},type_ = '{5}'
where playerid = "{4}"'''.format(economy,wickets_taken,bowling_avg,bestfigure,player_id,
Type)
cursor.execute(stbowlmodify)
cursor.execute(stbatmodify)
connect.commit()
Page 23 of 51
break
break
elif Action == "Delete":
while True:
import mysql.connector as sql
import Player_search
connect = sql.connect(host="localhost", user="root", passwd="shriram123",
database="sample")
cursor = connect.cursor()
player_id = input("Enter character id:")
st = "delete from players where playerid = '{0}'".format(player_id)
stbowldelete = "delete from bowlers where playerid = '{0}'".format(player_id)
stbatdelete = "delete from batsmen where playerid = '{0}'".format(player_id)
cursor.execute(st)
cursor.execute(stbowldelete)
cursor.execute(stbatdelete)
connect.commit()
break
else:
print("Please enter a given choice your choice was invalid")
def player_search():
import mysql.connector as sql
import Player_search
connect = sql.connect(host="localhost", user="root", passwd="shriram123", database="sample")
cursor = connect.cursor()
stbat = ""
stbowl = ""
print("Enter the necessary stats:")
Page 24 of 51
age = int(input("Enter required age:"))
while True:
speciality = input("Enter 'AR' or 'Bowler' or batsmen:")
if speciality not in ("AR", "Bowler", "batsmen"):
print("Incorrect speciality enter again")
continue
else:
break
if speciality in ("batsmen", "AR"):
avg_runs = int(input("Enter required avg runs per match:"))
strikerate = int(input("Enter required strike rate:"))
preffered_position = int(input("Enter Preffered position"))
stbat = '''select * from players,batsmen
where (avg_runs between {0} and {1}) and
(strikerate between {2} and {3}) and
(preffered_position between {4} and {5}) and
players.playerid = batsmen.playerid '''.format(avg_runs - 100, avg_runs + 100,
strikerate - 100,
strikerate + 1000, preffered_position - 50,
preffered_position + 500)
if speciality in ("Bowler", "AR"):
economy = int(input("Enter required economy:"))
bowling_avg = int(input("Enter required bowling average:"))
Type = input("Enter required Type:")
stbowl = '''select * from players,bowlers
where (economy between {0} and {1}) and
(bowling_avg between {2} and {3}) and
(type_ = "{4}") and
bowlers.playerid = players.playerid'''.format(economy - 100, economy + 100,
Page 25 of 51
bowling_avg - 500, bowling_avg + 500,
Type)
if stbowl != "" and stbat != "":
stboth = '''select * from players,batsmen,bowlers
where (avg_runs between {0} and {1}) and
(strikerate between {2} and {3}) and
(preffered_position between {4} and {5}) and
(economy between {6} and {7}) and
(bowling_avg between {8} and {9}) and
(type_ = "{10}") and
players.playerid = batsmen.playerid and batsmen.playerid = bowlers.playerid
'''.format(avg_runs - 100, avg_runs + 100, strikerate - 100,
strikerate + 1000, preffered_position - 50,
preffered_position + 500,economy - 100,
economy + 100, bowling_avg - 500, bowling_avg + 500,Type)
print('playername', 'nationality', 'age', 'current_team', 'speciality', 'no_matches','Price'
, sep='|', end="|")
print('avg_runs', 'strikerate', 'preffered_position', 'bestcore','Runs','', sep='|',end="")
print("economy", "wicket taken", "bowling avg", 'bestfigure','Type', sep='|')
cursor.execute(stboth)
n=1
for i in cursor:
print(n,")",sep="",end="")
n=n+1
for j in i[1:12]:
print(j,end = "|")
for k in i[13:14]:
print(k, end="|")
for l in i[15:20]:
Page 26 of 51
print(l, end="|")
print()
elif stbat != "" and stbowl == "":
print('playername', 'nationality', 'age', 'current_team', 'speciality','no_matches',"price"
,sep = '|', end = "")
print('avg_runs', 'strikerate', 'preffered_position', 'bestcore','runs', sep='|')
cursor.execute(stbat)
n=1
for i in cursor:
print(n, ")", sep="", end="")
n=n+1
for j in i[1:12]:
print(j,end = "|")
for k in i[13:14]:
print(k,end="|")
print("\b")
else:
print('playername', 'nationality', 'age', 'current_team', 'speciality', 'no_matches', "price"
, sep='|', end="")
print('economy', "wicket taken", "bowling avg","bestfigure",sep = "|")
cursor.execute(stbowl)
n=1
for i in cursor:
print(n, ")", sep="", end="")
n=n+1
for j in i[1:12]:
print(j, end="|")
for k in i[13:14]:
print(k, end="|")
Page 27 of 51
print("\b")
def password(Type):
import mysql.connector as sql
connect = sql.connect(host="localhost", user="root", passwd="shriram123", database="sample")
cursor = connect.cursor()
while True:
username = input("Enter your username:")
cursor.execute("Select * from passwrd")
password = input("Enter your password:")
for i in cursor:
if i[1] == username and i[2] == password and i[3] == Type:
print("Hello", username)
return username
break
else:
print("Incorrect login credentials,TRY AGAIN")
continue
break
Page 28 of 51
RELATED TABLES AND OUTPUT
Page 29 of 51
Page 30 of 51
Page 31 of 51
Page 32 of 51
Page 33 of 51
Page 34 of 51
Page 35 of 51
Page 36 of 51
Page 37 of 51
Page 38 of 51
Page 39 of 51
Page 40 of 51
Page 41 of 51
Page 42 of 51
Page 43 of 51
Page 44 of 51
Page 45 of 51
Page 46 of 51
Page 47 of 51
Page 48 of 51
PROJECT IMPACT
Page 49 of 51
FUTURE SCOPE AND DEVELOPMENT
● This work can be extended in the future in such a way that the database management system
can make use of machine learning-based algorithms that predicts the cost at which a player can
be sold in the auctions
● The players' selling price can be estimated using their past performance parameters like runs,
balls, innings, wickets and matches played via machine learning regression models
● The exponential rise in popularity of fantasy games in India also has paved way for a new market
that could benefit from such digital infrastructures.
Page 50 of 51
BIBLIOGRAPHY
● www.python.org
● www.geeksforgeeks.com
● www.programiz.com
● The Complete Reference Python by Martin C. Brown from Mc. Grawhill publication
● Computer Science with Python by Sunita Arora from Dhan Patrai & co. publication
Page 51 of 51