[英]Creating database tables regarding Primary and Foreign Keys
I'm doing an activity online where I need to create an example database for an Airline. 我正在进行在线活动,需要为航空公司创建示例数据库。 It details the general information needed to be put into each table but I need help linking certain tables.
它详细说明了需要放入每个表中的一般信息,但是我需要链接某些表的帮助。
I've drawn up tables in Word to help me grasp the connections between tables but I'm unsure if I'm doing it correctly. 我已经在Word中草拟了表格,以帮助我掌握表格之间的联系,但是我不确定自己是否做得正确。
I have a table called 'Staff' that looks like this: 我有一个名为“ Staff”的表,如下所示:
I was asked to create another table that provides each staff members previous work experience such as the company they worked for and join and end dates, etc. The 'Work Experience' table: 我被要求创建另一个表,该表为每个员工提供以前的工作经验,例如他们工作的公司以及加入和结束日期等。“工作经验”表:
My question is, what would be the primary key for the Work Experience table? 我的问题是,“工作经验”表的主键是什么? Seeing as Staff_ID references back to the Staff table could it be both a Primary Key and a Foreign Key?
看到Staff_ID引用了Staff表,它既可以是主键又可以是外键?
只需创建一个通用的work_experience_id或we_id(无论您希望使用哪种方式),以便每次您想要给员工打电话之前的工作经验时,只需选择通用ID主键即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.