[英]Multiple possible values inserted into one column from another table while using the same primary Key
My title is probably not the best. 我的头衔可能不是最好的。 I simply cant articulate what I'm trying to do in the title. 我只是无法在标题中清楚说明我要做什么。 I have about 8 different tables for this project. 我为此项目准备了大约8张不同的表格。 Two specifically are giving me some issues. 具体来说有两个给我一些问题。 I've spent some time researching how to achieve third normal form, but I can't quite see how this may be possible with my current design. 我花了一些时间研究如何实现第三范式,但是我不太了解当前的设计是如何实现的。 I need some guidance to see how rows will be inserted while not increment a primary key per row. 我需要一些指导,以了解如何在不增加每行主键的情况下插入行。 I'll elaborate below. 我将在下面详细说明。
tblONe: (tblOneId, GUID, PolicyNum, LineNum) tblONe:(tblOneId,GUID,PolicyNum,LineNum)
LineNumTbl LineId, LineName LineNumTbl LineId,LineName
LineNumTbl
1 MCAL
2 MCNT
3 MCCG
4 MCGL
5 MCPD
6 MCTI
7 MCXC
8 MCXU
These will be selections made from a user then inserted into a DB. 这些是用户做出的选择,然后插入到数据库中。 A user may choose one of these or multiple. 用户可以选择其中之一或多个。
You can see my "tblONe" schema. 您可以看到我的“ tblONe”架构。 If a user makes one selection, it's easy to see how the LineId will be inserted into LineNum. 如果用户选择了一个选项,则很容易看到如何将LineId插入LineNum。 However, I'm running into an issue seeing how someone may choose multiple and keep the same primary key..( I auto increment based on row creation in other tables. ) 但是,我遇到了一个问题,看看有人如何选择多个并保持相同的主键。(我根据其他表中的行创建自动递增。)
My thought is it would look something like this. 我的想法是看起来像这样。
1001, (Random GUID), 1234ABC, 1
1001, (""), 1234ABC, 3
1001, (""), 1234ABC, 5
1001, (""), 1234ABC, 8
Is this possible to achieve? 这有可能实现吗? Or should I just create the table with 8 separate columns for these LineNums? 还是应该为这些LineNum创建带有8个单独列的表? Thanks in advance for your help 在此先感谢您的帮助
我建议您将tblOne的密钥tblOneId添加到LineNumTbl
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.