0

I'm building a gambling-related website where people can be on soccer fixtures (matches). A fixture ends up with a result: home win - draw - away win. I have one table for teams and one table for fixtures and another for bets. The fixtures table has a home team and an away team. But how do I model a draw bet? It's easy to have the bet table refer to the fixture and refer to the team. But a draw?

2
  • The bet doesn't refer to a team; the bet refers to the outcome of a fixture. You don't record the team that will win; you record the outcome of the match. Don't forget you'll need customers and that it is customers who place bets. Commented Sep 8, 2009 at 13:56
  • Also, in the classic (UK) pools, there is a distinction between a score-draw (eg 1-1) and a no-score-draw (ie 0-0). Just an FYI. Commented Sep 8, 2009 at 13:57

1 Answer 1

5

The most basic system:

3 tables, one for teams, one for fixtures and one for bets. Outcomes are represented by:

0 => Draw, 1 => Home win, 2 => Away win

Teams:

id | name
-----------------
 1 | Some team 
 2 | Some team
 3 | Some team

Fixtures:

id | home team | away team | result
--------------------------------------
 1 |         1 |         3 |        0
 2 |         2 |         3 |        2
 3 |         1 |         3 |        1

Bets:

id | fixture   | outcome    
---------------------------
 1 |         1 |         0 
 2 |         2 |         1 
 3 |         1 |         3 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.