sql - Correct Normalization for Players to Match -
There are 14 players in each match.
I currently have 14 entries in the match that I enter in the table like this:
matchID bookingID player id 1 1 1 1 2 1 1 3 1 1 4 etc.
Is it OK or will it be more acceptable to do this:
matchID bookingIID player id1 player id2 player id3 player id4 1 1 1 2 3 4
No, "generalization" in this context means that you have more than one You want to create a table, match , MatchPlayer , booking , and player depending on their primary key, Related to For example:
Match Table:
Milan Id booking ID ----------------- - --- Player Match Table:
MatchID player ID ------------ - ----- booking table:
booking ID ---------- < / Code> player table:
player ID -------- Now in the MatchID Match table is the primary key and it is the foreign key in the MatchPlayer table, and PlayerID Player The primary key in Alika and MatchPlayer foreign key table. It creates a "lot" relationship between matches and players, because in many matches a player can participate, and of course there are many players in any match.
In addition, the BookingID booking is the primary key in the table and it is the foreign key in the match table, and this case In, "Relationship between one and several" bookings and matches because there can be many matches in each booking.
From this perspective you are allowed to record Mail in table, first name, last name, age, gender, etc. Similarly, this allows you to keep a record about information about bookings, such as date, place name, etc.
Considering your current example, generalization seems unnecessary because you do not have any additional information about players and bookings, but it seems that your schema is quick to include more information Can expand.
Comments
Post a Comment