Database Design - Monthly server billing tracker
I am trying to design a simple SQLite database to bill players on a server. The server is paid for on a monthly basis at a cost of $10 (but this might change). I would like to have the following tables (or something better):
Months:
-id (int primary key)
-ref (text) something like "JAN11 just for readability"
-cost (real) something like 10 or 9.5 the monthly cost of the server
Players:
-id (int primary key)
-name (text)
The cost should be divided among the players who logged on at the end of th开发者_如何学Ce month (ie. 5 people log in in January they get the $10 split among them).
In short: I don't know how to store whether or not the players logged in during the month so as to divide the cost among them.
Another good table to have would be Logins
, e.g.:
Logins:
id int,
player_id int,
month_id int
That way you could just check if a player logged in, or even also check how many times they logged in (assuming you wanted to track that).
精彩评论