Lab 1 - Cricket League Management
Lab 1 - Cricket League Management
DBMS: LAB 1
DDL (Data Definition Language) Commands
Cricket League Management System
OBJECTIVE: To learn and understand DDL statements while executing queries.
DDL (Data Definition Language) queries in MySQL are used to define and manage the structure
and characteristics of your database and its objects.
Some of the important DDL commands are:
• CREATE: This DDL query establishes a new database object, such as a table or an index,
with defined attributes and structure.
• ALTER: The ALTER query modifies the structure of an existing database object, enabling
tasks like adding or modifying columns.
• TRUNCATE: This DDL query removes all the data from a table while retaining the table
structure, resulting in improved performance compared to the DROP TABLE query.
• DROP: This DDL query deletes a database object, such as a table or an index, along with
its associated data irreversibly.
• RENAME: The RENAME query changes the name of an existing database object, like
altering the name of a table.
INSTRUCTIONS:
• As a part of LAB 1, there are 2 tasks that are to be completed
o TASK 1: For the given Description, ER diagram, and Relational Schema, you are
expected to create the corresponding DDL commands for the same.
o TASK 2: There are certain questions that have been given. These are to be
executed on the DDL statements created in TASK 1, and the explanations of the
approach used.
• The sample of Screenshots required for every task has been given below.
• As a part of the submission process, the following are to be submitted:
o A PDF document, containing all the Screenshots for both tasks as suggested
▪ Name of the file: `<your SRN>_Cricket_league_DB_Lab1.pdf
o The “.sql” file for the same, shall contain all the commands that have been
executed in the lab
▪ Name of the file: `<your SRN>_Cricket_league_DB_Lab1.pdf
Example:
Refer to the sample submissions given below. This will give you an idea about the details that
must be included in your submissions
NOTE: Screenshots has to be taken from “Command Line Client”
Task 1:
Task 1 involves creating tables using CREATE TABLE statements. For every table created, 2
screenshots are required:
1. CREATE TABLE statement
2. DESC statement and its output
Sample submission:
Task 2:
Task 2 involves modifying the structure of the tables created in Task 1. For every modification
made, 3 screenshots are required:
1. Structure of the table before modification
2. DDL statement
3. Structure of the table after modification
Sample submission:
NOTE :
• Try highlighting the modification made. In the example given above, the
default value of the section attribute was changed to ‘A’ and the row
corresponding to the attribute section was highlighted to emphasize this
change
• Certain constraints are not displayed in the output of the DESC statement
(eg: CHECK constraint). You need to use SQL commands that display
constraints associated with a given table. Make sure to use these commands
to display the said constraints in both Task-1 and Task-2.
DESCRIPTION:
The world of the IPL cricket league in a down-to-earth way! Imagine a big cricket
tournament that lasts for two months. It's like a sports festival where players from
different countries gather to play cricket. Each playing team comprises 11 players which
include a maximum of 4 foreign players to encourage local talent and a leader known as
the captain.
Now, let's talk about the players. They are the heart of the game, each with their own
special skills. Some players who are experienced are considered legends of the game
whereas some are newbies. The players are allowed to play only till 40 hence it’s very
important for everyone to participate in these league matches weather they are a pro or
a noob. Some players are really good at hitting the ball, trying to score runs for their team.
Others are bowlers who throw the ball with different techniques to try and get the
batsman out. Then there are fielders who run and catch the ball to stop the other team
from scoring. And we can't forget the wicketkeeper, who stands behind the wickets and
is quick to catch the ball and try to get the batsman out if they make a mistake, So every
player lies in one of the four categories: Batsmen, Bowler ,Wicket keeper or All-rounder.
Every player is assigned a ranking that reflects their performance in different roles, such
as batting, bowling, and wicket-keeping. These rankings provide insights into how skilled
a player is in each specific job on the field. For instance, a player might have a high ranking
as a batsman, indicating their proficiency in scoring runs, while their ranking as a bowler
showcases their ability to take wickets. These role-specific rankings contribute to a
comprehensive understanding of a player's strengths and contributions to their team's
success, every player has a unique jersey number, it serves as a source of identification
for fans and teammates.
Teams play against each other. It's like a big competition where two teams face off. They
play in stadiums, which are like big sports arenas while some teams play matches in their
home stadium where they practice day in and day out. People come to watch the
matches, cheer for their favourite teams, and enjoy the excitement. After the match, we
will find out which team won and which team didn't do as well. Tickets for every match
are sold. The prices of the tickets vary from every stand in the stadium as well as for every
match and minimum price for a ticket is ₹1000. There are 3 umpires for a match who
ensure that all rules and protocols of the match are followed and give very crucial
decisions on every ball of the match .He is unbiased like the judge in any court.
Let's not forget about the points table. It's like a scoreboard that shows how well each
team is doing. It keeps track of wins, losses, and calculates points based on how good a
team's performance is and total points are assigned 0 initially and depending on the
results of the matches the points keep increasing or remain the same. This helps us see
which teams are doing the best and whenever there’s tie in positions run rate decides the
position even 0.1 matters while qualifying.
Behind the scenes, coaches play a crucial role. They are like teachers who help players
practise, learn new strategies, and improve their skills. Each team has its own set of
coaches who guide them to perform better. Each coach has a specific role like batting
coach, bowling coach and fielding coach. Coaches are associated with a team therefore
whenever a Coach's associated TeamID is updated, the TeamID of the coach is set to null.
There are times where some teams withdraw from the league, at that time players of the
team should be deleted from the players table immediately [on delete constraints]
In a nutshell, the IPL cricket league is a real-world tournament where teams compete,
players show off their skills, and coaches provide guidance. It's like a puzzle where all the
pieces – teams, players, coaches etc – come together to create an exciting cricket event
that people enjoy watching and being part of!
ER Diagram:
The E-R diagram for the above description would be:
RELATIONAL SCHEMA:
TASK 1:
For the given ER diagram, Relational schema, and the constraints described in the description,
execute the DDL commands for making the Cricket League database system.
Make sure that all the constraints are taken into consideration.
TASK 2:
For each of the questions, the required explanation as to why you have selected that approach
is to be specified. Along with this the screenshots also shall be taken as given in the sample above.
Questions:
1. In the Cricket League Management System database, the team management has
realized that the maximum allowed age for players should be adjusted due to changes
in league rules. They want to modify the existing check constraint on the 'DateOfBirth'
column of the 'Player' table to enforce a maximum age of 35 years instead of the current
40 years. The management is curious about the process of modifying existing constraints
and the impact of this change on the validity of the stored data.
2. Rename the table rankings to player_Ranking and make sure that the column "rank"
appears before the player_ID.
3. In the Cricket League Management System database, the management is aware of the
importance of accurate player data and wants to prevent any discrepancies caused by
missing or incomplete birthdate information. To ensure that birthdays are always
recorded for players, the management is considering adding a constraint to the 'Player'
table.
4. In the Cricket League Management System database, since not every player in the player
table will be in playing 11 so in order to access who is playing and who is not the
management has decided to create one more column in the player table which says
whether a player is playing or not