sports league database design
Posted
by
John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2011-03-01T07:05:39Z
Indexed on
2011/03/01
7:25 UTC
Read the original article
Hit count: 150
sql
|database-design
Hello,
I'm developing a database to store statistics for a sports league. I'd like to show several tables: - league table that indicates the position of the team in the current and previous fixture - table that shows the position of a team in every fixture in the championship
I have a matches table: Matches (IdMatch, IdTeam1, IdTeam2, GoalsTeam1, GoalsTeam2)
Whith this table I can calculate the total points of every team based on the matches the team played. But every time I want to show the league table I have to calculate the points.
Also I have a problem to calculate in which position classified a team in the last 10 fixtures cause I have to make 10 queries.
To store the league table for every fixture in a database table is another approach, but every time I change a match already played I have to recalculate every fixture from there...
Is there a better approach for this problem?
Thanks
© Stack Overflow or respective owner