Games league database

Soldato
Joined
27 Dec 2005
Posts
17,296
Location
Bristol
I'm making a website to digitise a local boules league. Has anyone made a league database before, and is there anything I'm missing?

Teams play in various leagues (not ranked, just groups) with the two top teams going into a knockout. The knockout needn't be digitised on the fly as it's all played on one day but it would be good to log the results and show the overall winner etc.

Any tips? Should I also have a LEAGUE table or is it ok to calculate positions every time based on the MATCHES database?

Code:
TEAMS
id
email
password
name
league

MATCHES
id
date
team1
team2
score1
score2
difference
winner

Any tips appreciated!
 
Associate
Joined
7 Nov 2013
Posts
255
Location
Kent, England
I would personally calculate positions very time based upon the matches table just in case you ever entered a match incorrectly, it could prove awkward to then retrospectively fix up the LEAGUE table.

I also hope that password field is actually a hash of a salt and a password :)
 
Associate
Joined
16 Aug 2010
Posts
1,373
Location
UK
You can just calculate the ranking based on the matches database each time the page is requested, I am sure it won't be intensive unless you have thousands of entries? :p
 
Soldato
OP
Joined
27 Dec 2005
Posts
17,296
Location
Bristol
I would personally calculate positions very time based upon the matches table just in case you ever entered a match incorrectly, it could prove awkward to then retrospectively fix up the LEAGUE table.

I also hope that password field is actually a hash of a salt and a password :)

I'm no pro so unsure what you mean by salt and password? I generally use MD5, certainly no plain text here.

You can just calculate the ranking based on the matches database each time the page is requested, I am sure it won't be intensive unless you have thousands of entries? :p

Yeah what I figured. And no, not thousands :p. It's an inter-business league with probably about 40 companies. Digitizing it for a bit of free advertising :).
 
Associate
Joined
16 Aug 2010
Posts
1,373
Location
UK
Md5 is not useful for passwords. Can be cracked easily. Consider a more appropriate hashing algorithm. Google will tell you some recommendations.

A salt is a random string used in the generation of a hash along with the password, so identical passwords don't generate the same hash.
 
Last edited:
Soldato
Joined
20 Dec 2004
Posts
16,024
You can just calculate the ranking based on the matches database each time the page is requested, I am sure it won't be intensive unless you have thousands of entries? :p

Or the sensible approach, which is to calculate the league standing whenever a match result is added or modified :p
 
Soldato
Joined
28 Oct 2006
Posts
12,456
Location
Sufferlandria
I would create a league table and have it linked to both teams and matches. If teams can move between leagues then in might be difficult to track which league a match belongs to.
 
Back
Top Bottom