Hello,
I'm designing a small database where soccer results are going to be stored.
I have created following tables:
FB_Teams, with primary key I_TEAM_ID, storing team data.
FB_Competitions, with primary key I_COMPETITION_ID, where I want to keep details of leagues, cups, etc.
As most of you know, exactly two teams participate in soccer game. Order is not important for me. My question is - how to design FB_Fixtures table, which I'd like to use to keep matches results in ? Each fixture is a single game which belongs to some competition.
My initial idea was:
I_FIXTURE_ID - int, identity, primary key
I_COMPETITION_ID - int, foreign key referencing FB_Competitions
I_TEAM_A_ID - int, foreign key referencing FB_Teams
I_TEAM_B_ID - same as above
I_TEAM_A_GOALS - int, amount of goals scored by team A
I_TEAM_B_GOALS - int, amount of goals scored by team B
I don't like this though. First, it introduces some order (team A and team B), second - it makes writing queries quite difficult. Any ideas how to solve it in a better way ?
I'm designing a small database where soccer results are going to be stored.
I have created following tables:
FB_Teams, with primary key I_TEAM_ID, storing team data.
FB_Competitions, with primary key I_COMPETITION_ID, where I want to keep details of leagues, cups, etc.
As most of you know, exactly two teams participate in soccer game. Order is not important for me. My question is - how to design FB_Fixtures table, which I'd like to use to keep matches results in ? Each fixture is a single game which belongs to some competition.
My initial idea was:
I_FIXTURE_ID - int, identity, primary key
I_COMPETITION_ID - int, foreign key referencing FB_Competitions
I_TEAM_A_ID - int, foreign key referencing FB_Teams
I_TEAM_B_ID - same as above
I_TEAM_A_GOALS - int, amount of goals scored by team A
I_TEAM_B_GOALS - int, amount of goals scored by team B
I don't like this though. First, it introduces some order (team A and team B), second - it makes writing queries quite difficult. Any ideas how to solve it in a better way ?