我做了一个数据库的事情已经有一段时间了,所以我想知道是否有人可以帮我组织一些数据。这就是我所拥有的:
理想情况下,我会把它放到一个简单的MySQL数据库中,但是如果有另一种方式/媒介来组织这个,请告诉我,我愿意接受任何和所有的建议。
答案 0 :(得分:1)
这是粗略设计 :(您可能需要根据您的要求修改数据库)
tblTeams
------------------------------
team_id | int | primary key
team_name | varchar| not null
tblPositions
-----------------------------
position_id| int | primary key
pos_name | varchar|
tblPlayers
------------------------------
player_id | int | primary key
player_name| varchar
team_id | int | foreign key tblTeams(team_id)
tblManagers
-----------------------------
manager_id | int | primary key
name | varchar
tblManager_mapping
-----------------------------
id | int | primary key
manager_id | int | foreign key tblManagers(manager_id)
player_id | int | foreign key tblPlayers(player_id)
tblSubjects
----------------------------
sub_id | int | primary key
sub_name | varchar
tblTeachers
-----------------------------
teacher_id | int | primary key
name | varchar
tblTeacher_player_mapping
-----------------------------
id | int | primary key
teacher_id | int | foreign key tblTeachers(teacher_id)
player_id | int | foreign key tblPlayers(player_id)
tblTeacher_subject_mapping
-----------------------------
id | int | primary key
teacher_id | int | foreign key tblTeachers(teacher_id)
sub_id | int | foreign key tblSubjects(sub_id)
teaching_since| date
修改强>
在您澄清一个玩家可以拥有多个职位时添加新表。 (还从position_id
删除了tblPlayers
)
tblPlayers_position
-----------------------------
mapping_id | int | primary key
player_id | int | foreign key tblPlayers(player_id)
position_id| int | foreign key tblPositions(position_id)