Professional Documents
Culture Documents
About
Case study
FierceOne Sdn. Bhd. wishes to develop a new mobile application, named “BingBing Legend”
which is a Multi-Player Online Battle Arena game. The company has completed its game flow plan and
interface designs, but as for database design, the company has hired our team to help in designing and
implementing the database. This BingBing Legend mobile game has several requirements and features
that need to be satisfied as stated in the given scenario.
The Team
Page | ii
BingBing Legend Mobile Game Database system
Abstract
This project designs, implements, and documents a database system for BingBing Legend Mobile
Game as per the specification of FierceOne Sdn. The project starts by outlining the disadvantages of a
file-based system as a general concept and for BingBing Legend specifically, and how a database system
is an efficient solution. The project then _IDentifies the business rules of the system creating a
nomalized databases, and then present the data in an Entity Relationship. Finally, along with some
queries, a database schema is implemented with a DDL and DML.
Page | iii
BingBing Legend Mobile Game Database system
Table of Content
Contents
About .............................................................................................................................................................ii
Case study ..................................................................................................................................................ii
The Team ...................................................................................................................................................ii
Abstract ........................................................................................................................................................iii
Table of Content ...........................................................................................................................................iv
Table of Figures ...........................................................................................................................................vii
Table of Tables............................................................................................................................................viii
1.0 Database and Database Management System ........................................................................................ix
Disadvantages of File-based system .........................................................................................................ix
Advantages of Database and DBMS ........................................................................................................ix
2.0 Business Rules .........................................................................................................................................x
2.1 Defenition ............................................................................................................................................x
2.2 Keywords .............................................................................................................................................x
2.3 Business rules with respect to BingBing Legend Online Game ..........................................................x
2.3.1 Entities: .........................................................................................................................................x
2.3.2 Attributes ....................................................................................................................................xii
2.3.3 Relationships ............................................................................................................................xvii
2.4 Constraints ........................................................................................................................................xxi
2.4.1 Logical Constraints ....................................................................................................................xxi
2.4.2 Null Constraints .........................................................................................................................xxi
2.4.3 Unique Constraints ....................................................................................................................xxi
2.4.4 Primary Keys Constraints ..........................................................................................................xxi
2.4.5 Default Constraints ...................................................................................................................xxii
3.0 Normalization .....................................................................................................................................xxiii
3.1 Definition........................................................................................................................................xxiii
3.2 Benefits ...........................................................................................................................................xxiii
3.3 Forms ..............................................................................................................................................xxiii
3.3.1 Unnormalized form (UNF) ......................................................................................................xxiii
3.3.2 First normalized form (1NF) ...................................................................................................xxiv
3.3.3 Second normalized form (2NF) ...............................................................................................xxiv
3.3.4 Third normalized form (3NF) ...................................................................................................xxv
4.0 Entity Relationship Diagram ..............................................................................................................xxvi
4.1 Definition ........................................................................................................................................xxvi
4.1.1 steps involved in creating an ERD include:.............................................................................xxvi
4.2 Designing Database ........................................................................................................................xxvi
Page | iv
BingBing Legend Mobile Game Database system
Page | v
BingBing Legend Mobile Game Database system
Page | vi
BingBing Legend Mobile Game Database system
Table of Figures
Figure 1: Entity-relationship Diagram .........................................................................................................23
Figure 2: Data Base Diagram Schema .........................................................................................................24
Figure 3: EERD ...........................................................................................................................................25
Page | vii
BingBing Legend Mobile Game Database system
Table of Tables
Table 1: Entities ...........................................................................................................................................12
Table 2: Attributes........................................................................................................................................16
Table 3: Relationships..................................................................................................................................17
Table 4: Data Dictionary ..............................................................................................................................30
Table 5: Player Account Table .....................................................................................................................34
Table 6: Hero Table ......................................................................................................................................34
Table 7: Skin Table ......................................................................................................................................35
Table 8: Personal Statistics Table ................................................................................................................35
Table 9: Player Hero Table ..........................................................................................................................36
Table 10: Hero Skin Table ...........................................................................................................................36
Table 11: Game Mode Table ........................................................................................................................37
Table 12: Team Table ...................................................................................................................................38
Table 13: Game Table .................................................................................................................................38
Table 14: Workload Matrix - Section 1........................................................................................................44
Table 15: Workload Matrix - Section 2........................................................................................................45
Page | viii
BingBing Legend Mobile Game Database system
Example: The game will record and save information such as game _ID, game date, game time, list of
heroes, and heroes’ levels, and the game/battle’s results, which means that the list of heroes, heroes’
levels may be same for each game played. These games played are also not dependent on each other.
Data Inconsistency – Various copies of the same data may contain different values. If data needs to be
updated or modified then all the files containing that data need to be modified as well (Thakur, 2015).
Example: If a certain change is made in for a game, it needs to be changed for all the upcoming
games that will be played.
Accessing Anomalies – It is not easy to access data in a desired or efficient way, making the
supervision of departments very difficult and inefficient. So if a user wants information in a specific
manner then they require creating a separate program for it (Thakur, 2015).
Example – If the developer needs to access players that have more than 700 diamonds or a list of
heroes, they’ll need to create a separate program to execute a search algorithm.
Data Consistency – Data normalization also takes care of data inconsistency, so a change made can be
implemented in every department on the database.
Easy Data Recovery – DataBse Management System (DBMS) keeps backup of data, so it is easier to
recover the data in case of an error/ failure.
Data Security and Privacy – The data accessed in DBMS is limited, which means it is private, and it
is easier to apply constraints in databases so only an authorized user can access the data. Each user
has a different set of access therefore data is secured from threats such as _IDentity theft, misuse, and
data leaks (cited in beginnersbook.com, 2015).
Page | ix
BingBing Legend Mobile Game Database system
2.1 Defeni?on
The Business rules are brief, precise, and unambiguous descriptions of policies, procedures, or
principles within a specific organization:
• Must be kept up to date
• Sometimes are external to the organization
• Describe characteristics of the data as viewed by the company
Business rules are derived from the case study to effectively _IDentify relationships that entities
within a business have between one another, and what relationship they are in, what attributes are
stored and so forth.
2.2 Keywords
The business rules define the entities, attributes, relationships, and constraints of data in the database.
Each of those keywords is defined as per below:
• Entity - anything about which data are to be collected and stored
• Attribute - a characteristic of an entity
• Relationship - describes an association among entities which can be:
o One-to-many (1:M) relationship
o Many-to-many (M:N or M:M) relationship
o One-to-one (1:1) relationship
• Constraint - a restriction placed on the data
2.3.1 EnOOes:
1. Player
2. Personal-Statistics
3. Hero
4. Skin
5. Player-Hero
6. Hero-Skin
7. Game-Mode
8. Team
Page | x
BingBing Legend Mobile Game Database system
9. Game
Addi?onal inclusions
✓ A Player-Hero entity was introduced as a br_IDge-table and the best way to link the player to the
heroes they own. This entity behaves like an array which the company can query to display the list of
heroes owned by a player as per below:
o The statement can also be nested to get the name of a given hero_ID
✓ Much like the Player-Hero entity, the Hero-Skin entity was introduced to show the skins a hero has of
a particular play.
o Note that since we want to access the heroes the player own this entity will refer to the
Player-Hero entity.
✓ Our team assumes that a Game-Mode entity is needed to store the different types of arenas and game
modes available to be referenced by the game entity.
✓ The team table makes the queries for starting a game much faster even without an implemented index.
This is achieved because the entity holds the _ID of the heroes of specific players joining and
represents them in one unique _ID.
✓ Lastly, our team assumes that to store information about each game a game entity is essential since all
of its attributes do not depend on other attributes of the other entities.
Entities
Player Any user of this game will get a unique player account that holds
his information in-game.
Hero An entity that holds all the information about the heroes the
players can own and use in the game as per their role.
Skin Holds details of skin for each hero that the player can equip.
Page | xi
BingBing Legend Mobile Game Database system
Player-Hero An entity that links a player to a hero they own and represent the
hero’s level. This entity makes it easy and efficient to select all the
heroes that the player owns.
Hero-Skin This entity refers to the player hero entity and _IDentifies all the
skins of a particular hero owned by the specified player.
Game An entity that holds information about the games played their
results and participants.
Game-Mode An entity that stores all the game modes that can be picked and
played by teams.
Table 1: Entities
2.3.2 AQributes
-Primary keys are underlined and italic.
-Foreign keys are defined just like primary keys, but they end with an *.
• Player:
1. Player_ID
2. Player_Name
3. Username
4. Email
5. Global_lvl
6. Diamonds
7. Battle_Points
8. Online_Status
• Personal-Statistics:
1. Player_ID*
2. MostUsed_Hero*
Page | xii
BingBing Legend Mobile Game Database system
3. Details
4. PrevGame_Result
• Hero:
1. Hero_ID
2. Hero_Name
3. Hero_Role
4. Hero_Speciality
5. Hero_Price
• Skin:
1. Skin_ID
2. Skin_Name
3. Hero_ID*
4. Skin_Price
• Player-hero:
1. Ph_ID
2. Player_ID*
3. Hero_ID*
4. Lvl
• Hero-Skin:
1. Ph_ID*
2. Skin_ID*
• Game-Mode:
1. Mode_ID
2. Mode_Type
3. Mode_Name
4. Arena
• Team:
1. Team_ID
2. Ph_ID1*
3. Ph_ID2*
4. Ph_ID3*
Page | xiii
BingBing Legend Mobile Game Database system
5. Ph_ID4*
6. Ph_ID5*
• Game:
1. Game_ID
2. Mode_ID*
3. Game_Duration
4. Battle_DateTime
5. Game_Loser
6. Game_Winner
Addi+onal inclusions
The normalization subsection contains a further explanation.
✓ The Hero’s ID was included in the skin entity, instead of the name, because it gives the company the
ability to change the name in one area, i.e. the hero entity and it will be updated everywhere else.
o Thus preventing Update and deletion anomaly.
✓ The Player has a name attribute that is used when sending them an email or update as the name makes
the message more customizable.
✓ Ph_ID is added to Player-Hero as a mean for the Hero-Skin entity to reference it, making the query
speed for the Hero-skin much faster.
o Preventing Insertion and update anomaly.
✓ Team_ID is created in team-member to be referenced in the game entity.
o Preventing Insertion anomaly.
✓ The game entity has a Battle_DateTime instead of two separate attributes because both the date and
time can be stored in a DateTime data type.
✓ The Game result attribute was replaced by two attributes in the game entity: Game_loser and
Game_Winner. Those two attributes summarize the result in a way that easy to understand and
represent as illustrated in the attributes table.
Attributes
Player
Player_Name Player’s real name, which is used when sending the player emails and
updates to make the messages dynamic.
Page | xiv
BingBing Legend Mobile Game Database system
Diamonds An integer that holds the number of diamonds the player owns.
Battle_Points An integer that holds the number of battle points the player earned and
currently owns.
Online_Status A bool where true means online and false means offline.
MostUsed_Hero A foreign key to the Hero_ID, located in the Hero entity, of the most used hero
by the player.
PrevGame_Result A bool where True means the player one last game they played and false means
they lost.
Hero
Hero_ID A unique primary key to each hero, automatically incremented.
Hero_Name The hero’s name such as Dark Rose, Rafaela, Tigreal, Fanny, and Estes,
Cyclops, Lolita, Clint, etc.
Hero_Role A description of the hero’s role such as Fighter, Tank, Assassin, etc.
Hero_Speciality A description of the hero’s specialty such as Charge, Regen, Reap, etc.
Hero_Price An integer representing the Hero’s price in diamonds and battle points.
Skin
Page | xv
BingBing Legend Mobile Game Database system
Hero_ID A foreign key to the Hero_ID, located in the Hero entity, that represents the hero
who can be equipped by the skin.
Skin_Price An integer representing the skin’s price in diamonds and battle points.
Player-hero
Ph_ID A unique primary key to each player and the corresponding hero,
automatically incremented.
Hero_ID A foreign key to the Hero_ID, located in the Hero entity, that represents the hero
corresponding to the player.
Player_ID A foreign key, referencing the Player_ID located in Player, which represents the
_ID of the player that owns the hero of Hero_ID.
Lvl The current level of a specific hero owned by the specified player.
Hero-Skin
Ph_ID A foreign key, referencing Ph_ID located in the Player-Hero entity, which
represents a specific hero of the specific player.
Skin_ID A foreign key, referencing skin_ID located in the skin entity and represents the
skin of the given hero that the player owns.
Game-Mode
Mode_ID A unique primary key to each of the three available game modes,
automatically incremented.
Mode_Type The specific type of the mode: Brawl mode, Human vs AI mode, or Classic
Mode.
Team
Page | xvi
BingBing Legend Mobile Game Database system
Ph_ID1 A foreign key, referencing Ph_ID located in Player-hero, this _ID represents the
chosen hero’s information of the first player.
Ph_ID2 A foreign key, referencing Ph_ID located in Player-hero, this _ID represents the
chosen hero’s information of the second player.
Ph_ID3 A foreign key, referencing Ph_ID located in Player-hero, this _ID represents the
chosen hero’s information of the third player.
Ph_ID4 A foreign key, referencing Ph_ID located in Player-hero, this _ID represents the
chosen hero’s information of the fourth player.
Ph_ID5 A foreign key, referencing Ph_ID located in Player-hero, this _ID represents the
chosen hero’s information of the fifth player.
Game
Game_ID A unique primary key to each that has been played, automatically
incremented.
Game_Duration An integer representing the duration of the game in seconds which can be
converted into an appropriate form when needed.
Battle_DateTime A DATETIME variable that holds the date and time in which the game has
started.
Game_Loser A foreign key referencing the Team_ID of the team that lost the game.
Game_Winner A foreign key referencing the Team_ID of the team that won the game.
Table 2: Attributes
2.3.3 RelaOonships
1. Each player can befit many Heroes, many heroes can be befitted by a player. A hero befits by
many players, many players can befit by the same hero.
a. Many to many relationship (M:M)
Page | xvii
BingBing Legend Mobile Game Database system
2. Since the player can own many heroes, each player can be part of many player-heroes, many
player-heroes can have the same player.
a. One to many relationship (1:M)
3. Each hero is owned by many players and thus can be included in many player-heroes, many
player-heroes can have the same hero.
a. One to many relationship (1:M)
4. Each hero can have many skins, many skins can be owned by one hero.
a. One to many relationship (1:M)
5. Each player can buy many skins for his hero(es), many skins can be bought for the player’s
hero(es).
a. One to many relationship(1:M)
6. Each hero has many skins, many skins are wearable by the same hero.
a. One to many relationship (1:M)
7. Many skins can be owned by many players who have the prerequisite hero, many players who
have the required hero can have the same skin and many skins can be owned by a single player.
a. Many to many relationship (M:M)
8. Each team consists of five players, five players make up one team.
a. One to many relationship (1:M)
9. Two teams play one game, each game is played by two teams.
a. One to many relationship (1:M)
10. A game mode can be selected for many games, many games can be played in the same game
mode.
a. One to many relationship (1:M)
11. Each player has a personal statistic, each personal statistic is for a single player.
a. One to one relationship (1:1)
Jus?fica?ons
✓ The same hero can be owned by any player, but at the same time a player can own many heroes,
therefore it’s a many to many relationship.
✓ The same is true for the relationship between the player’s heroes and their skins.
✓ Since the Player-Hero entity was introduced, the one to many relationships is now represented by the
relationship between the Player-Hero entity and the two entities that reference it: Player and Hero.
o Relational database.
Page | xviii
BingBing Legend Mobile Game Database system
✓ The skin has two sets of relationships: skins available for each hero, and skins a player owns for
each of his heroes. They are represented by the relationship between the Hero and Skin entities, and
the Hero-skin and skin entities respectively.
o Relational database.
✓ A relationship exists between the team entity and player-hero instead of just player or hero because
the entity holds the player and the hero they picked along with their level which the game requires.
Relationships
Player 1:M Player-Hero Since the player can own many heroes, each player can be part of
many player-heroes, many player-heroes can have the same player.
Player-hero M:1 Hero Each hero is owned by many players and thus can be included in
many player-heroes, many player-heroes can have the same hero.
Player M:M Hero Each player can befit many Heroes, many heroes can be befitted by a
player. A hero befits by many players, many players can befit by the
same hero.
Hero 1:M Skin Each hero can have many skins, many skins can be owned by one
hero.
Player-Hero 1:M Hero-skins Each player can buy many skins for his hero(es), many skins can be
bought for the player’s hero(es).
Hero 1:M Skin Each hero has many skins, many skins are wearable by the same hero.
Hero-skin M:M Skin Many skins can be owned by many players who have the prerequisite
hero, many players who have the required hero can have the same
skin and many skins can be owned by a single player.
Team 1:M Player-Hero Each team consists of five players, five players make up one team.
Game 1:M Team Two teams play one game, each game is played by two teams.
Game-Mode 1:M Game A game mode can be selected for many games, many games can be
played in the same game mode.
Player 1:1 Personal-Statistic Each player has a personal statistic, each personal statistic is for
a single player.
Table 3: Relationships
Page | xix
BingBing Legend Mobile Game Database system
Page | xx
BingBing Legend Mobile Game Database system
2.4 Constraints
2.4.1 Logical Constraints
1. The player must own at least one hero before they can purchase the skins for that specific hero.
2. Both heroes and their skins can only be purchased using either diamonds or battle points.
3. A game mode must be picked before starting a game.
4. A team can contain five players: no more and no less.
5. A team can consist of active players only.
6. The choice of heroes must be unique in each team.
1. The Details attribute in the Personal_statistic table can be Null since at the start of the game the
player will not retain any details.
2. The mostUsed_Hero in the Personal_statistics table can be Null since at the start of the game the
player will not have used any heroes.
Page | xxi
BingBing Legend Mobile Game Database system
Page | xxii
BingBing Legend Mobile Game Database system
3.0 NormalizaOon
3.1 Defini?on
Database normalization is the process of organizing a database into tables and columns
effectively. Tables generated through normalization are specific to an entity and only including
supporting entities and attributes (Essential SQL, 2019).
3.2 Benefits
Normalization is used to minimize and eliminate redundancy as well as remove undesirable
characteristics: Insertion, Update, and Deletion Anomalies (www.javatpoint.com, 2011).
3.3 Forms
Three common forms transform an unnormalized form (UNF) into a normalized database
(Essential SQL, 2019):
1. First normalized form (1NF): Makes the tables in a database scalable so they can be
easily extended.
2. Second normalized form (2NF): removes all partial dependencies from the tables in a
database.
a. “Partial Dependency occurs when a non-prime attribute is functionally
dependent on part of a cand_IDate key” (www.tutorialspoint.com, n.d.).
3. Third normalized form (3NF): removes transitive dependencies from the tables in a
database.
a. “When an indirect relationship causes functional dependency it is called
Transitive Dependency” (www.tutorialspoint.com, n.d.) :
i. If P -> Q and Q -> R is true, then P-> R is a transitive dependency.
Page | xxiii
BingBing Legend Mobile Game Database system
Jus?fica?on
✓ While players can own a different number of heroes and a different amount of skins for each the
details for each such as their names, role, specialty and price remain constant and thus should be
separated into their tables and referenced with a primary key.
✓ The list of winning players or losing players is nothing but a repetition of players that can be
separated into its table.
Jus?fica?on
✓ Since the informa+on stored in the and the data of each game mode is not directly related to the
primary key of the player table, they are both separated into their tables with their primary keys.
Page | xxiv
BingBing Legend Mobile Game Database system
Hero-Skin(Ph_ID*, Skin_ID*)
Jus?fica?on
✓ Personal sta+s+cs were separated into its table since it holds plenty of details that are best-accessed
indiv_IDual and thus we have separate aCributes.
✓ Heroes level and the skins owned both depend on the heroes owned and not the player _ID,
therefore they are all separated into two tables.
✓ The Player-Hero table corresponds to each hero with his player and represents that hero’s level.
✓ Hero-Skin corresponds to every player’s hero to the skins of that hero that the player owns.
✓ Now that we have an op+mal way to represent the player’s hero and their level, we use Ph_ID in the
Team table.
Page | xxv
BingBing Legend Mobile Game Database system
4.1 Defini?on
An en+ty-rela+onship diagram (ERD) is a data modeling technique that graphically illustrates an
informa+on system’s en++es and the rela+onships between those en++es. In short, an ERD is a
conceptual and representa+onal model of data used to represent the en+ty framework
infrastructure. (Techopedia.com, 2019)
The elements of an ERD are:
• En++es
• Rela+onships
• ACributes
*Those elements are defined and explained in the business rules.
Page | xxvi
BingBing Legend Mobile Game Database system
Page | xxvii
BingBing Legend Mobile Game Database system
Page | xxviii
BingBing Legend Mobile Game Database system
5.1 EERD
Figure 3: EERD
Attributes
Player table
Variable Description Key Constraints Data
Type
Page | xxix
BingBing Legend Mobile Game Database system
Page | xxx
BingBing Legend Mobile Game Database system
Skin table
Variable Description Key Constraints Data
type
Skin_ID A unique primary key to each skin,
PRIMARY KEY NOT NULL INT
automatically incremented. IDENTITY
Player-hero table
Variable Description Key Constraints Data
type
Page | xxxi
BingBing Legend Mobile Game Database system
Hero-Skin table
Variable Description Key Constraints Data
type
Ph_ID A foreign key, referencing Ph_ID
located in the Player-Hero entity,
which represents a specific hero of the NOT NULL INT
specific player. FK
Game-Mode table
Variable Description Key Constraints Data
type
Mode_ID A unique primary key to each of the
three available game modes,
automatically incremented. PRIMARY KEY NOT INT
IDENTITY NULL
Page | xxxii
BingBing Legend Mobile Game Database system
Team table
Variable Description Key Constraints Data
type
Team_ID A unique primary key to each team
created automatically incremented. PRIMARY KEY NOT NULL INT
IDENTITY
Game table
Variable Description Key Constraints Data
type
Game_ID A unique primary key to each that
has been played, automatically PRIMARY KEY NOT
incremented. IDENTITY NULL
Page | xxxiii
BingBing Legend Mobile Game Database system
Page | xxxiv
BingBing Legend Mobile Game Database system
/* Creating and using the DataBase */
CREATE DATABASE BingBing;
USE BingBing;
-- Player account table:
-- Holds the user's information and progress
CREATE TABLE Player(
Player_ID INT NOT NULL PRIMARY KEY IDENTITY(1, 1),
Player_Name VARCHAR(255) NOT NULL UNIQUE,
Username VARCHAR(255) NOT NULL UNIQUE,
Email VARCHAR(255) NOT NULL UNIQUE,
Global_lvl INT NOT NULL DEFAULT 1,
Diamonds INT NOT NULL DEFAULT 250,
Battle_Points INT NOT NULL DEFAULT 3000,
-- 0 for Flase and any other value for True
Online_Status BIT
);
-- Hero table:
-- Holds all of the heroes information
CREATE TABLE Hero(
Hero_ID INT NOT NULL PRIMARY KEY IDENTITY(1, 1),
Hero_Name VARCHAR(255) NOT NULL UNIQUE,
Hero_Role VARCHAR(255) NOT NULL,
Hero_Speciality VARCHAR(255) NOT NULL,
Hero_Price INT NOT NULL
);
-- Skin table:
Page | xxxv
BingBing Legend Mobile Game Database system
-- Holds all of the heroes information
CREATE TABLE Skin(
Skin_ID INT NOT NULL PRIMARY KEY IDENTITY(1, 1),
Skin_Name VARCHAR(255) NOT NULL UNIQUE,
Skin_Price INT NOT NULL,
Hero_ID INT NOT NULL REFERENCES Hero(Hero_ID)
);
-- Personal Statistics table:
-- Holds additional information about the player
CREATE TABLE Personal_Statistic(
Player_ID INT NOT NULL REFERENCES Player(Player_ID),
MostUsed_Hero INT REFERENCES Hero(Hero_ID),
Details VARCHAR(255),
-- 0 for Flase and any other value for True
PrevGame_Result BIT
);
-- Player Hero table:
-
Holds the level of the referenced hero owned by the specified playe
r, and is referenced in the Hero Skin table
CREATE TABLE Player_Hero(
Ph_ID INT NOT NULL PRIMARY KEY IDENTITY(1, 1),
Player_ID INT NOT NULL REFERENCES Player(Player_ID),
Hero_ID INT NOT NULL REFERENCES Hero(Hero_ID),
lvl INT NOT NULL DEFAULT 1
);
Page | xxxvi
BingBing Legend Mobile Game Database system
-- Game Mode table:
-- Holds information about every game mode available
CREATE TABLE Game_Mode(
Mode_ID INT NOT NULL PRIMARY KEY IDENTITY(1, 1),
-- Brawl mode, Human vs AI mode, or Classic Mode
Mode_Type VARCHAR(255) NOT NULL,
Mode_Name VARCHAR(255) NOT NULL UNIQUE,
Arena VARCHAR(255) NOT NULL UNIQUE,
);
-- Team table
-
Holds the names of the team members joining the game, their heroes
and the heros' levels
CREATE TABLE Team(
Team_ID INT NOT NULL PRIMARY KEY IDENTITY(1, 1),
Ph_ID1 INT NOT NULL REFERENCES Player_Hero(Ph_ID) UNIQUE,
Ph_ID2 INT NOT NULL REFERENCES Player_Hero(Ph_ID) UNIQUE,
Ph_ID3 INT NOT NULL REFERENCES Player_Hero(Ph_ID) UNIQUE,
Ph_ID4 INT NOT NULL REFERENCES Player_Hero(Ph_ID) UNIQUE,
Ph_ID5 INT NOT NULL REFERENCES Player_Hero(Ph_ID) UNIQUE,
);
-- Game Table
-- Holds the information of all the games played
CREATE TABLE Game(
Game_ID INT NOT NULL PRIMARY KEY IDENTITY(1, 1),
Mode_ID INT NOT NULL REFERENCES Game_Mode(Mode_ID),
Game_Duration INT NOT NULL,
Battle_DateTime DATETIME NOT NULL,
Game_Loser INT NOT NULL REFERENCES Team(Team_ID),
Game_Winner INT NOT NULL REFERENCES Team(Team_ID)
);
Page | xxxvii
BingBing Legend Mobile Game Database system
Inside the tables the following rows have been inserted based on their datatypes:
Page | xxxviii
BingBing Legend Mobile Game Database system
Page | xxxix
BingBing Legend Mobile Game Database system
Page | xl
BingBing Legend Mobile Game Database system
Page | xli
BingBing Legend Mobile Game Database system
Page | xlii
BingBing Legend Mobile Game Database system
Query 1
/* Query 1 */
SELECT Player_Name, Email FROM Player
WHERE Player_Name LIKE '%er%' OR Player_Name LIKE '%on%'
ORDER BY Player_Name;
Query 2
/* Query 2 */
SELECT * FROM Player WHERE
Player_ID =
(SELECT Player_ID FROM PlayerHero WHERE lvl > 3);
Query 3
/* Query 3 */
SELECT Hero.Hero_ID, Hero.Hero_Name, Player_Hero.lvl FROM Hero
INNER JOIN Player_Hero ON Player_Hero.Hero_ID = Hero.Hero_ID
WHERE Player_Hero.Player_ID =
(SELECT Player_ID FROM Player WHERE Player_Name='Wade Wilson');
Page | xliii
BingBing Legend Mobile Game Database system
Query 2
Query 3
Page | xliv
BingBing Legend Mobile Game Database system
Query 2
Query 3
Page | xlv
BingBing Legend Mobile Game Database system
Query 2
Query 3
Page | xlvi
BingBing Legend Mobile Game Database system
8.0 References
▪ beginnersbook.com. (2015). Advantages of DBMS over file system. [online] Available at: https://
beginnersbook.com/2015/04/dbms-vs-file-system/
▪ Essential SQL. (2019). Database Normalization (Explained in Simple English) - Essential SQL.
[online] Available at: https://www.essentialsql.com/get-ready-to-learn-sql-database-normalization-
explained-in-simple-english/. [Accessed: 14, May 2020].
▪ Techopedia.com. (2019). What is an Entity-Relationship Diagram (ERD)? - Definition from
Techopedia. [online] Available at: https://www.techopedia.com/definition/1200/entity-relationship-
diagram-erd.[ Accessed: 16 May 2020 ].
▪ Thakur, S. (n.d.). Disadvantages of File Processing System. [online] Available at: https://
whatisdbms.com/disadvantages-of-file-processing-system/
▪ www.javatpoint.com. (2011). DBMS Normalization - javatpoint. [online] Available at: https://
www.javatpoint.com/dbms-normalization. [Accessed: 14, May 2020].
▪ www.tutorialspoint.com. (n.d.). Partial Dependency in DBMS. [online] Available at: https://
www.tutorialspoint.com/Partial-Dependency-in-DBMS. [Accessed: 15, May 2020].
▪ www.tutorialspoint.com. (n.d.). Transitive dependency in DBMS. [online] Available at: https://
www.tutorialspoint.com/Transitive-dependency-in-DBMS [Accessed 15 May 2020].
Page | xlvii
BingBing Legend Mobile Game Database system
Sec?on 1
This section includes all the projects from 1 through 4 inclusive:
Sec?on 2
This section includes all the projects from 5 through 7 inclusive:
Page | xlviii
BingBing Legend Mobile Game Database system
Page | xlix