如何在表字段中插入多个值 [英] How to insert multiple value in table field

查看:170
本文介绍了如何在表字段中插入多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表打孔有名为EMPID,DATE,PMODe,PTIME的列。如果EMPID,DATE和PMODE的值具有相同的数据,我想在PTime列中插入用逗号分隔的多个值。





我正在使用前端作为Visual Basic 6.0 ..

My table punching have columns named EMPID, DATE, PMODe, PTIME.. I want to insert multiple values separated by comma in PTime column if value of EMPID, DATE and PMODE have same data.


I am using Front End as Visual Basic 6.0..

推荐答案

永远不要将多个值放入单列连续。它可以但不应该这样做。这是违反1NF原则的。在关系数据库设计中,每一行都不能有一个具有多个值的列,例如用逗号分隔。它们应分成多行。

了解更多:十个共同数据库设计错误/ [ ^ ]
Never put multiple values in a single column in a row. It can but should not be done. It is against 1NF principle. In relational database design, every row must not have a column that takes more than one value, like separated with commas. They should be separated into multiple rows.
Read more: ten-common-database-design-mistakes/[^]


除非绝对必要,否则不要插入逗号分隔值。

为每个逗号分隔值设置单独的字段。
Don't insert comma separated values unless absolutely necessary.
Have individual fields for each of those comma separated values.


您可以将字段数据类型更改为文本或可以接受文本数据的内容,然后每次新条目到达时,请阅读当前数据并附加新值并更新字段。



注意:这不会破坏1NF



缺点:

1)你已经失去了时间的意义。在将数据解析回各个时间条目之前,您将无法对此数据执行任何有意义的操作。



2)您可能会遇到数据质量问题(格式为搞砸了,遇到了数字预期的文字等等...)



底线是:你应该知道你在做什么:D
you may change the field data type to text or something which can accept text data and then each time a new entry arrives, read the current data and append it with new value and update the field.

Note: This will not break 1NF

Disadvantages:
1) You have lost the meaning of time. You will not be able to do any meaningful operations with this data until you parse it back to individual time entries.

2) You may encounter data quality issues( format is messed up, text is encountered where number is expected etc...)

The bottom line is: You should know what you are doing here :D


这篇关于如何在表字段中插入多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆