I have quite a bit of trouble to come up with a good design for my database, I tried two different examples, but none of them look as they hoped.
This is the script that I have:
Scenario:
The leaderboard consists of several servers, the server has a name, login address and description. The player has a name and a unique identifier. Various player actions are recorded along with the date when this action is performed. These are the actions that a player can perform:He can killHe can be killed (death)His playing time is recorded at the end of the match.He can win the game.For each action, the date must be recorded, so I can get a list of its statistics for the last week, last month, last year and in general.
The leaderboard consists of several servers, the server has a name, login address and description. The player has a name and a unique identifier. Various player actions are recorded along with the date when this action is performed. These are the actions that a player can perform:
For each action, the date must be recorded, so I can get a list of its statistics for the last week, last month, last year and in general.
, , , , table_kills table_deaths table_wins table_timeplayed
, ,
Update: ()
, , , :
Servers (id,servername) Players (id,playername,description,etc) Actions (id, actionid, actionname, details) PlayerActions (serverid,playerid,actionid,timestamp) PlayerGameTime (id, serverid, playerid, timeplayed, timestamp)
( , Players):
Kills | killed_player_id | killer_player_id | game_id | time_of_kill | 2 | 4 | 1 | 12-14-2013 02:14:24 AM | 4 | 2 | 1 | 12-14-2013 02:15:00 AM Games | game_id | winner_player_id | length_of_game | | 1 | 4 | 141245 | | 2 | 3 | 258881 |
, , , ..
, . .
Deaths, Kill, , .
SELECT p.Name, COUNT(k.id) as DEATHS FROM Players p JOIN Kills k on k.killed_player_id = p.id WHERE p.id = 3 GROUP ON k.id