Sei sulla pagina 1di 5

ITECH 2004 Data

Modelling
ASSIGNMENT 2: SQL

Prabin Bhusal 30356718


Contents
RELATIONAL SCHEMA ................................................................................................................................... 3
ASSUMPTION ................................................................................................................................................ 4
REFERENCE .................................................................................................................................................... 5
RELATIONAL SCHEMA
A relational database program is a standard tool for storing and analyzing data. The relational
schema with data types for each table used in this assignment is given below:

SEASON (SEA_ID INTEGER, SEA_Year YEAR)

GAME (GAME_ID VARCHAR (3), SEA_ID INTEGER, GAME_Location VARCHAR (25),


GAME_Date DATE, GAME_Conference VARCHAR (10))

VIDEODATAVIEW (VID_ID INTEGER, GAME_ID VARCHAR (3), VID_FirstHalf VARCHAR


(30), VID_SecondHalf VARCHAR (30))

TEAM (TEAM_ID VARCHAR(3), TEAM_Name VARCHAR (10), TEAM_Location VARCHAR


(20))

PLAYER (PLAY_ID VARCHAR (3), TEAM_ID VARCHAR (3), PLAY_Name VARCHAR (30),
PLAY_DateOfBirth DATE)

REFEREE (RED_ID VARCHAR (3), REF_Name VARCHAR (25), REF_DateOfBirth DATE)

EVENTSDATAVIEW (E_ID VARCHAR (3), TEAM_ID VARCHAR (3), GAME_ID VARCHAR (3),
E_Type VARCHAR (15), E_SubType VARCHAR (15), E_Period INTEGER,
E_StartVideoFrame INTEGER, E_StartTime VARCHAR(6), E_EndVideoFrom INTEGER,
E_EndTime VARCHAR (6), E_FROM VARCHAR (10), E_TO VARCHAR (10), E_StartX
VARCHAR (5), E_StartY VARCHAR (5), E_EndX VARCHAR (5), E_EndY VARCHAR (5))

TRACKSDATAVIEW (T_ID VARCHAR (5), GAME_ID VARCHAR (3), T_Period INTEGER,


T_VIdFrame INTEGER, T_Time VARCHAR (8) , T_BallX DECIMAL(5,5), T_BallY
DECIMAL(5,5), T_Ref1_X DECIMAL(5,5), T_Ref1_Y DECIMAL(5,5))

PLAYER_COORDINATES (PLAY_ID VARCHAR(3), T_ID VARCHAR(5), PLAYER_X_POSITION


DECIMAL(5,5), PLAYER_Y_POSITION DECIMAL(5,5))
ASSUMPTION
1. TEAM_ID is used in Player Table as a Foreign Key.
2. Due to Normalization Table TRACKSDATAVIEW is splitted into two table and new
table is formed PLAYER_COORDINATES which consists of PLAY_ID and T_ID as a
composite primary key.
3. TEAM_ID and GAME_ID is used as a foreign Key as the values reference to the
values in the Team and Game Table. Similarly, E_FROM and E_TO are also used as
foreign key as their values reference to the PLAY_ID of Player table.
4. VARCHAR, INTEGER, DATE, DECIMAL, YEAR are the data types that are used in
various attributes according to the values which can be seen in Relational
Schema.
VARCHAR is used when there are the character and number values.
INTEGER is used when there is number values.
DATE is used to store the date in YYYY-MM-DD format.
YEAR is used to store the Year of the Date.
DECIMAL is used to store decimal values.
5. The format of PLAY_DateOfBirth and REF_DateOfBirth is changed to YYYY-MM-
DD format because MYSQL doesnot accept the value in DD-MM-YYYY format
REFERENCE
University, F. (n.d.). ITECH 2004 DATA MODELLING. Retrieved from LECTURE SLIDES.