I am a novice when it comes to database design.
在数据库设计方面,我是新手。
Currently I have a user table with attributes like id, email, first/last name, password.
目前我有一个用户表,其中包含id,email,名/姓,密码等属性。
A user can have multiple educations.
用户可以有多种教育。
So I was thinking a table with id(user id), program, school, date start, date end. But if doing so, the table won't have a primary key.
所以我在想一个id(用户ID),程序,学校,日期开始,日期结束的表。但如果这样做,表将没有主键。
Should have make another id for education? What's a better design? Thanks for your help.
应该再为教育做一个id?什么是更好的设计?谢谢你的帮助。
2 个解决方案
#1
0
Yeah, it's perfectly acceptable to add an education id to the database. This will let you identify a particular education record.
是的,将教育ID添加到数据库是完全可以接受的。这将让您识别特定的教育记录。
Later, if your app grows, you'll be able to attach things to those education records. Eg, if you want to detail courses taken at different schools, you would use education id on the courses table to tie it back.
之后,如果您的应用程序增长,您将能够将这些内容附加到这些教育记录中。例如,如果您想详细说明在不同学校开设的课程,您可以在课程表上使用教育ID来将其绑定。
#2
0
If the user can have multiple educations why not have a link table;
如果用户可以有多种教育,为什么没有链接表;
Educations
的教育
EducationID
EduationName
etc
And
和
UserEducations
UserEducations
UserID
EducationID
This would allow for multiple Educations to be assigned to the user
这将允许将多个教育分配给用户
#1
0
Yeah, it's perfectly acceptable to add an education id to the database. This will let you identify a particular education record.
是的,将教育ID添加到数据库是完全可以接受的。这将让您识别特定的教育记录。
Later, if your app grows, you'll be able to attach things to those education records. Eg, if you want to detail courses taken at different schools, you would use education id on the courses table to tie it back.
之后,如果您的应用程序增长,您将能够将这些内容附加到这些教育记录中。例如,如果您想详细说明在不同学校开设的课程,您可以在课程表上使用教育ID来将其绑定。
#2
0
If the user can have multiple educations why not have a link table;
如果用户可以有多种教育,为什么没有链接表;
Educations
的教育
EducationID
EduationName
etc
And
和
UserEducations
UserEducations
UserID
EducationID
This would allow for multiple Educations to be assigned to the user
这将允许将多个教育分配给用户