为了避免数据重复 [英] To avoid repetition of data

查看:91
本文介绍了为了避免数据重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将数据从excel工作表上传到数据库时,如何避免重复数据?
如果已经存在,则意味着它应该替换它;否则,应该替换它.如果它不存在,则应该上载它.
1.从excel阅读下一行.
2.检查数据是否已经存在于表中(使用一些唯一列)
一个.如果是,则使用某些条件更新该行
b.如果否,则将其插入为新行
3.转到1.


How to avoid repetition of data while uploading data from excel sheet to database?
If it is already present means it shoul replace it otherwise if it is not there means it should upload it.

解决方案

Here is a little algorithm for that

1. read next row from excel.
2. check if the data exist in the table already(using some unique column)
a. if yes update that row using some conditions
b. if no then insert this as new row
3. go to 1.


这篇关于为了避免数据重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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