I am doing a project for my badminton club.
Intro
I want to create a database for players registration, such as the following:
CREATE TABLE Registration(
PlayerName_fkey text,
SchoolName_fkey text,
Category text,
TournamentNumber integer,
TypeOfPlay text,
Selected boolean
);
Note: It is not displayed here, but each column besides "Selected" is basically a foreign key to another table.
Question
For the registration section, I have entries for single play and doubles play.
The registration table would be almost identical, except the doubles have two players instead of one. I have the following choices:
- Create two tables, one for single players, one for double players
- Create one table and add an extra column double_partner which is always null for singles players.
Both options seem bad to me and I was wondering if there was another better option out there.
Thanks in advance!
Best Answer
Below is my first pass at a relatively simple system.
Don't know what RDBMS you're using, so your SQL may vary a bit depending.
For the first pass, I've decided to split the registration tables into singles and doubles - there may be better/more sophisticated methods of dealing with this.
You could think of having an Entrant table with either a singles or a doubles entity and maybe (probably as part of code and not in the RDBMS) ensure that teams (i.e., an Entrant with two members) can only enter doubles tournaments?
You might get more ideas from http://www.databaseanswers.org, here.
In particular, here and esp. here.
I think you might well need a bit more sophistication - you have nothing about attainment levels/qualification_prerequisites, heats or possibly even a tournament_location table - not every school may be able to host a tournament and may use other local courts. The list of potential fields is quite large. To say nothing of results?
You don't mention your RDBMS, if you still have a choice and you're going for an Open Source solution , I recommend PostgreSQL - it is infinitely more capable than MySQL.
Neither do you mention your development environment - not that it's critical, but it might be useful to know. The more information you provide here, the better.
A Google of "sports tournament schemas" brought up several possibly interesting sites (here inter alia).
A+