I have spent countless hours working on a database that tracks foosball stats. We have been tracking stats with this database since early 2004. (Please no geek comments... ;-) We track the scores, but also the winning/losing percentages of positions, etc.
The table structure is very simple, but I have a very hard time creating queries. I wonder if my understanding of normalization is incorrect and if my table structure is bad. The underlying database is so simple, it seems to me that I should be able to create queries and reports with more ease than I do. Perhaps it is my own shortcomings, but I was hoping to get some thoughts from you experts.
DB Structure: (3 tables)
Games
- GameID (PK)
- Type <-- Doubles or Singles
- ScoreA
- ScoreB
- Date
Players
- PlayerID (PK)
- FirstName
- LastName
- Inactive <-- Yes/No
- PicName
- email
Positions
- PositionID (PK)
- GameID (FK to Games)
- PlayerID (FK to Players)
- Position <-- DefenseA, DefenseB, OffenseA, OffenseB
Each Game (doubles) ends up with four players. (ie. the Positions table has 4 entries for each game. 2 entries for each singles game.)
The main problem that I am experiencing is that anytime I want to create a report. I have to create several queries that build on each other, before I get to any interesting data. Is that typical behavior for a normalized database, or is my table structure messed up? For instance, to build a report that counts the number of games a player has won and who that player partnered with is quite a project.
I would like to rebuild/update this database. Any suggestions from you experts would be greatly appreciated.
The table structure is very simple, but I have a very hard time creating queries. I wonder if my understanding of normalization is incorrect and if my table structure is bad. The underlying database is so simple, it seems to me that I should be able to create queries and reports with more ease than I do. Perhaps it is my own shortcomings, but I was hoping to get some thoughts from you experts.
DB Structure: (3 tables)
Games
- GameID (PK)
- Type <-- Doubles or Singles
- ScoreA
- ScoreB
- Date
Players
- PlayerID (PK)
- FirstName
- LastName
- Inactive <-- Yes/No
- PicName
Positions
- PositionID (PK)
- GameID (FK to Games)
- PlayerID (FK to Players)
- Position <-- DefenseA, DefenseB, OffenseA, OffenseB
Each Game (doubles) ends up with four players. (ie. the Positions table has 4 entries for each game. 2 entries for each singles game.)
The main problem that I am experiencing is that anytime I want to create a report. I have to create several queries that build on each other, before I get to any interesting data. Is that typical behavior for a normalized database, or is my table structure messed up? For instance, to build a report that counts the number of games a player has won and who that player partnered with is quite a project.
I would like to rebuild/update this database. Any suggestions from you experts would be greatly appreciated.