[英]How can I organize this set of data into a mysql database?
It's been a little while since I've done anything making a database so I was wondering if someone could help me out in organizing some data. 自从我完成数据库创建工作以来已经有一段时间了,所以我想知道是否有人可以帮助我组织一些数据。 This is what I have: 这就是我所拥有的:
Ideally I would put this into a simple MySQL DB but if there's another way/medium to organize this please let me know, I'm open to any and all suggestions. 理想情况下,我会将其放入一个简单的MySQL数据库中,但是如果有另一种组织方式,请告诉我,我欢迎任何建议。
Here is rough design : (you might have to modify db according to your requirements) 这是一个粗略的设计 :(您可能必须根据需要修改db)
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
EDIT: Added new table as you clarified one player can have multiple positions. 编辑:添加新表,因为您澄清一个球员可以有多个位置。 (also removed position_id
from tblPlayers
) (还从tblPlayers
删除了position_id
)
tblPlayers_position
-----------------------------
mapping_id | int | primary key
player_id | int | foreign key tblPlayers(player_id)
position_id| int | foreign key tblPositions(position_id)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.