Linked Questions

975 votes
12 answers
1.2m views

While executing an INSERT statement with many rows, I want to skip duplicate entries that would otherwise cause failure. After some research, my options appear to be the use of either: ON DUPLICATE ...
Thomas G Henry LLC's user avatar
0 votes
1 answer
3k views

I did a backup file for an existing database and when I want to import this file to a new database I'm getting this error and the import process is stopped: ERROR 1062 (23000) at line 38: Duplicate ...
Pahoran Alanis's user avatar
1103 votes
12 answers
1.2m views

I started by googling and found the article How to write INSERT if NOT EXISTS queries in standard SQL which talks about mutex tables. I have a table with ~14 million records. If I want to add more ...
warren's user avatar
  • 33.6k
16 votes
3 answers
12k views

I want to write a program add new item to table. This item has an unique key name and it can be created by one of 100 threads, so I need to make sure that it is inserted only once. I have two ideas: ...
user3245050's user avatar
10 votes
5 answers
2k views

I was once told that it is faster to just run an insert and let the insert fail than to check if a database entry exists and then inserting if it is missing. I was also told that that most databases ...
Holtorf's user avatar
  • 1,491
6 votes
4 answers
2k views

I have a table with 3 columns. Each has a unique index. I'd like to do multiple inserts at once (300 records a pop). When a duplicate entry occurs it cancels the insert in its entirety. This means ...
Steve's user avatar
  • 21.5k
2 votes
2 answers
3k views

I have a requirement to insert a row into a table if a row does not already exist, and I need to do this using a stored procedure. I therefore need to select to check if the row already exists, ...
Tim Lloyd's user avatar
  • 38.6k
2 votes
1 answer
2k views

I'm currently using Jooq for a project, but I need a way to ignore duplicate keys on insert. I've got an array of objects I want to write into a table but if they already exist determined by a ...
Nick Long's user avatar
  • 1,978
0 votes
1 answer
2k views

I am working on a live site http://spectnlens.com/. so when I tack backup and unzip files on my localhost i get one error There has been an error processing your request SQLSTATE[23000]: Integrity ...
Shakir Khan's user avatar
0 votes
1 answer
770 views

Using PHP's PDO with a MySQL database, how do I get the number rows affected by an INSERT ... ON DUPLICATE KEY UPDATE ... statement? For instance, how would it be done with the following query? ...
user1032531's user avatar
  • 26.5k
0 votes
1 answer
605 views

i am using the following code to update a database from an xml file, everything works as intended but now i have to add 2x more fields to the table and update the data manually via a html form. when ...
NavyPixel's user avatar
  • 260
1 vote
2 answers
276 views

I have to import some data in my database . And there are some record already exist in table, not all. So what I want to do that: Run a php script for inserting data in table from input array Make ...
user avatar
0 votes
2 answers
466 views

I am trying to do time series product database that tracks a product stock quantities (100k+ products). It will be updated from a CSV file every 30 min and I only want to insert a new record if the ...
Tim's user avatar
  • 105
0 votes
2 answers
280 views

I Have an array with all the id's in my MySQL DB. In second array, have ID's which I need to insert into the same table. I need to check if the Id's which I am going to insert are present in first ...
Amith Raj Shetty's user avatar
1 vote
1 answer
237 views

I have a list I need to synchronize with a MySQL database. Here's an example procedure: I have a table with metadata: +-------+ | value | +-------+ | test | | val | | smtn | | foo | +-------+ ...
XLordalX's user avatar
  • 594