什么是为男子双打比赛存储夹具的最佳方式

时间:2018-03-08 11:11:36

标签: mysql database-design relational-database

我正在设计一个体育应用程序,我需要为网球中的男子双打比赛创建双打锦标赛的夹具,然后将其存储以备将来使用。在双打中,2名球员作为一支球队对阵另一支2名球员。夹具看起来像附加的图像

Doubles tournament Fixture

对于夹具中的每场比赛,我需要记录得分,然后获胜者/亚军。对于第二轮比赛,我需要知道哪位比赛获胜者将参加第二轮比赛。

我设计的数据库是这样的。如果有更好的设计,请告诉我。

create table doubles_fixture(
    doubles_fixture_id bigint(20) not null auto_increment primary key,
    fixture int not null,#fk fixture
    round varchar(32),
    match1 bigint(20),#fk doubles_match
    match2 bigint(20),#fk doubles_match
    player1 bigint(20), #fk ,
    player2 bigint(20),#fk
    player3 bigint(20),#fk
    player4 bigint(20),#fk
    game varchar(16) not null check (game IN ('badminton','cricket','tt','carrom','chess','tennis')),
    match_score varchar(128),
    winner1 bigint(20),
    winner2 bigint(20),
    winner1_points_gain float,
    winner2_points_gain float,
    losser1_points_lost float,
    losser2_points_lost float,
    match_start_time timestamp,
    match_end_time timestamp,
    constraint doubles_fixture_fk1 foreign key(fixture) references fixture(fixture_id),
    constraint doubles_fixture_fk2 foreign key(match1) references singles_fixture(doubles_fixture_id),
    constraint doubles_fixture_fk3 foreign key(match2) references singles_fixture(doubles_fixture_id),
    constraint doubles_fixture_fk4 foreign key(player1) references oyetournament_user(user_id),
    constraint doubles_fixture_fk5 foreign key(player2) references oyetournament_user(user_id),
    constraint doubles_fixture_fk6 foreign key(winner) references oyetournament_user(user_id),
    constraint doubles_fixture_fk7 foreign key(player3) references oyetournament_user(user_id),
    constraint doubles_fixture_fk8 foreign key(player4) references oyetournament_user(user_id)
)ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;

0 个答案:

没有答案