Database Design for Betting Community
Quite a task, but here is my attempt:
Members
table stores members data; includingPerformanceFactor
which is periodically re-calculated based on correctness of one's answers.Transactions
table tracks money deposits and withdrawals for each member. TheType
field could be 1=deposit, 2=withdrawal, 3=transfer from winnings.- One contest can have many questions, a question belongs to one contest only.
- One member can place many member-bets, a member-bet belongs to one member only.Place UNIQUE constraint on
MemberID, ContestID
to prevent member placing several bets for a specific contest - One member-bet has several answers, each answer belongs to one member bet only; each answer relates to a question. Place UNIQUE constraint on
MemberBetID, QuestionID
to prevent member placing several answers for a specific question. DerivedAnswers
table contains answers obtained by "statistical analysis" of member answers for a specific contest. Place UNIQUE constraint onContestID, QuestionID
to prevent repeating an answer for a specific question.