English 中文(简体)
将 MySQL 数据从一个表格移动到另一个重复的跳过( 或覆盖)
原标题:Move MySQL Data from one Table to Another Skip duplicate (or overwrite)

我需要定期上传CSV到我的SQl

所以我计划上传 csv 到一个临时表格。 而不是将数据从 临时_ tabt 移动到 main_ tabt

现在,我需要帮助:

  1. How can I move data. And (a) skip duplicate, or (b) overwrite duplicate
  2. The csv currently contains 55566 rows, and will increasing day by day. So, how to handle execute time.
  3. Best practice to import csv to mysql.
问题回答
  1. 我怎样才能移动数据

    使用 < a href=> "http://dev.mysql.com/doc/en/Infode-select.html" rel="nofollow"\\ code>INSERT... SELECT 。

    (a) 跳过重复,或(b) 覆盖重复

    定义 < a href=> "http://dev.mysql.com/doc/en/constraint-brime-key.html" rel="nofollow"\\code >UNIQUE 关键限制, 限制用于确定记录是否重复的列; 然后 :

    (a) 使用INSERT IGNORE ;或

    (b) 使用INSTER...在 DUPLACE KEY UPDATE 或REPLACE 。

  2. csv 目前包含55566行, 并将逐日增加 。 因此, 如何处理执行时间 。

    每次上传后旋转您的 CSV 文件, 以便不重复上传过去的记录 。

  3. 将CSV导入 Mysql 的最佳做法。

    使用





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签