What list of information would you need to buy the correct game?
-
Upload
jayson-hampton -
Category
Documents
-
view
222 -
download
0
Transcript of What list of information would you need to buy the correct game?
Platform
PS3PS3Fallout 3Fallout 3
Title
Version
Game of year edition
Game of year edition Do these pieces of
information uniquely identify this game?
How else could we uniquely identify
this game?
GameID
12021202
No other game will have the same ID
No other game will have the same ID
Unique identifiers for the game could be:
Title + Version + Platform
GameID
or a combination of
Key
Composite Key
What do we call the pieces of information that uniquely
identify the game ?
We can use keys to find game information from different sources:
Game reviews
Game Prices
Title + Version
+ Platform
Title + Version
+ Platform
£
Gamer and game relationship ..
Steve Kim JoGamer:Gamer:
Games:Games:
How many games could Steve own?How many people could own Modern
Warfare”?
Gamer to Games relationship: 1 gamer can have many games
1 gamer can have many games
many gamers can have the same game
many gamers can have the same game
Gamer Game
many to many relationship (n:n)
many to many relationship (n:n)
What kind of relationship is this?
Steve, Jo and Kim write the list of games they want for xmas:
Modern Warfare 2
Modern Warfare 2
BioshockTomb RaiderTomb Raider
Fable II
Using these lists would you be able to buy the correct game
& send it to the correct gamer?
KimSteve
Jo
Platform
X360X360
Title
Modern Warfare 2Modern
Warfare 2GameID
54265426
CompanyName
Infinity WardInfinity Ward
What additional game data might we need?:
Modern Warfare 2Modern Warfare 2
BioshockTomb RaiderTomb Raider
Fable II
We need more information to identify the correct game:
GameID Title Platform Company Name
5426
5426
2112
1110
7003
1110
Modern Warfare 2
Modern Warfare 2
Fable II
Tomb Raider
Bioshock
Tomb Raider
X360
X360
X360
X360
X360
X360
Infinity Ward
Infinity Ward
LionHead
EIDOS
2K
EIDOS
Game list has information that uniquely identifies the game
e.g. GameID
Modern Warfare 2
Modern Warfare 2
BioshockTomb RaiderTomb Raider
Fable II
Steve LonelySteve Lonely
What additional gamer information might we need?:
GamerIDGamerID
90899089
A unique GamerID would
be ideal !!
A unique GamerID would
be ideal !!
NameName
23 Jan 198023 Jan 1980
DateofBirthDateofBirth
KimSteve
Jo
We need more information to identify the correct gamer:
GamerIDGamerID NameName DateofBirthDateofBirth
Steve Lonely 23 Jan 19809089
Kim Newbie 10 Mar 19913120
Jo Headshot 31 Dec 19687707
Gamer list has information that uniquely identifies the gamer
e.g. GamerID
KimSteve
Jo
Can we now buy the correct game & send it to the correct gamer?
GamerIDGamerID NameName DateofBirthDateofBirth
Steve Lonely 23 Jan 19809089
Kim Newbie 10 Mar 19913120
Jo Headshot 31 Dec 19687707
GameID Title Platform Company Name
5426
5426
2112
1110
7003
1110
Modern Warfare 2
Modern Warfare 2
Fable II
Tomb Raider
Bioshock
Tomb Raider
X360
X360
X360
X360
X360
X360
Infinity Ward
Infinity Ward
LionHead
EIDOS
2K
EIDOS
Which gamer wants which game?
Steve wants 3 games for xmas
How could we rewrite this information on one note?
Modern Warfare 2
BioshockTomb Raider
Steve
Steve - Modern Warfare, Bioshock, Tomb Raider
Write all games in a line against Steves name ….
How do we add games to the list ?
GamerIDGamerID NameName DateofBirthDateofBirth
Steve Lonely 23 Jan 19809089
This is called a ‘repeating’ field …
GameID
5426
GameID
1110
GameID
7003
GameID
1910
GameID
4410
GameID
2010
GameID
9910
GameID
12310
GameID
1210
We could add games by adding more and more columns …
Steve - Modern Warfare
Steve – Bioshock
Steve - Tomb Raider
Write Steves name against each game ..
How do we add games to the list ?
We could add games without adding more columns just data…
GamerIDGamerID NameName DateofBirthDateofBirth
Steve Lonely 23 Jan 19809089 5426
1110
7003Steve Lonely 23 Jan 19809089
Steve Lonely 23 Jan 19809089
GameIDGameID
980Steve Lonely 23 Jan 19809089
7720Steve Lonely 23 Jan 19809089
Steve – Modern Warfare 2, Bioshock, Tomb Raider…
Which is the best way to join our lists together and why?
Steve - Modern Warfare 2Steve - Bioshock
Steve - Tomb Raider
OR
Congratulations !!!
Step 1 of the normalisation process
‘Avoid repeating fields when linking lists/tables’
You have just witnessedone of the great mysteries of the database universe !!
Lets see this work against our data?
GamerIDGamerID NameName DateofBirthDateofBirth
Steve Lonely 23 Jan 19809089
GameID Title Platform Company Name
5426
1110
7003
Modern Warfare 2
Tomb Raider
Bioshock
X360
X360
X360
Infinity Ward
EIDOS
2K
We have a link – is there a problem?
GameID
5426
Can we improve our ‘repeating field’ design?
GamerIDGamerID NameName DateofBirthDateofBirth GameID
Key field
GamerID
Repeating field
GameID
make the repeating field part of the key …
GamerID GameID
We could add games without adding more columns just data…
GamerIDGamerID NameName DateofBirthDateofBirth
Steve Lonely 23 Jan 19809089 5426
1110
7003Steve Lonely 23 Jan 19809089
Steve Lonely 23 Jan 19809089
GameIDGameID
980Steve Lonely 23 Jan 19809089
7720Steve Lonely 23 Jan 19809089
Good design No repeating
fields !!
Are there any other great mysteries ?
Step 2 of the normalisation process
‘non key fields should depend upon all parts of the key’
non key fields ‘Name’, ‘DateofBirth’ should depend upon
all parts of the key ‘GamerID & GameID’
GamerIDGamerID NameName DateofBirthDateofBirth
Steve Lonely 23 Jan 19809089 5426
1110
7003Steve Lonely 23 Jan 19809089
Steve Lonely 23 Jan 19809089
GameIDGameID
980Steve Lonely 23 Jan 19809089
7720Steve Lonely 23 Jan 19809089
Is ‘DateofBirth’ Gamer data or Game data or
both?
Is ‘Name’ Gamer data or Game data or
both?
Gamer only !
(GamerID)
Gamer only !
(GamerID)
non key fields depend on just a bit of the key not all of it !!!
.. we can improve this design ..
… but whats the point …. ?
To remove all that duplicate data !!!!
Move ‘Name’ and ‘DateofBirth’ to their own table?
5426
1110
7003
GameIDGameID
980
7720
NameName DateofBirthDateofBirth
Steve Lonely 23 Jan 1980
Steve Lonely 23 Jan 1980
Steve Lonely 23 Jan 1980
Steve Lonely 23 Jan 1980
Steve Lonely 23 Jan 1980
GamerIDGamerID
9089
9089
9089
9089
9089
GamerIDGamerID NameName DateofBirthDateofBirth
Steve Lonely 23 Jan 19809089
But what about the GameID field?
5426
1110
7003
GameIDGameID
980
7720
GameID needs to remain with the GamerID to keep the link between games and gamers
Non key fields should depend upon all parts of the key ..
GamerIDGamerID NameName DateofBirthDateofBirth
Steve Lonely 23 Jan 19809089 5426
1110
7003Steve Lonely 23 Jan 19809089
Steve Lonely 23 Jan 19809089
GameIDGameID
980Steve Lonely 23 Jan 19809089
7720Steve Lonely 23 Jan 19809089
GamerIDGamerID NameName DateofBirthDateofBirth
Steve Lonely 23 Jan 19809089
5426
1110
7003
GameIDGameID
980
7720
GamerIDGamerID
9089
9089
9089
9089
9089
original table
becomes
Is there anything else we can improve… ?
GamerIDGamerID NameName DateofBirthDateofBirth
Steve Lonely 23 Jan 19809089
5426
1110
7003
GameIDGameID
980
7720
GamerIDGamerID
9089
9089
9089
9089
9089
GameID Title Platform Company ID
5426
1110
7003
Modern Warfare 2
Tomb Raider
Bioshock
X360
X360
X360
4322
1120
5422
980 Dead Space X360 0922
7720 GOW X360 8727
Company Name
Infinity Ward
EIDOS
2K
EA
EPIC
Remove non key dependencies… an example …
GameID Title Platform Company ID
5426
Etc.
7003
Modern Warfare 2
Bioshock
X360
X360
4322
5422
Company Name
Infinity Ward
2K
CompanyName is dependent
upon ComanyID
not GameID
Move CompanyName to
its own table
Remove non key dependencies… ?
GameID Title Platform Company ID
5426
Etc.
7003
Modern Warfare 2
Bioshock
X360
X360
4322
5422
Company Name
Infinity Ward
2K
GameID Title Platform Company ID
5426
Etc.
7003
Modern Warfare 2
Bioshock
X360
X360
4322
5422
Company ID
4322
5422
Company Name
Infinity Ward
2K
becomes 2 tables