sql >> Database >  >> RDS >> Mysql

MySQL-fout met dubbele sleutel veroorzaakt een gedeelde vergrendeling op het dubbele indexrecord?

.1. Het vereist een vergrendeling van de bestaande invoer, zodat volgende pogingen om een ​​duplicaatrecord in te voegen consequent mislukken:

-- Transaction A
BEGIN TRANSACTION;
INSERT INTO mytable VALUE(1); -- fails as "duplicate"

-- Transaction B
BEGIN;
DELETE FROM mytable WHERE field = 1; -- must be put on hold, see below

-- Transaction A
-- transaction is still in progress
INSERT INTO mytable VALUE(1); -- must fail to stay consistent with the previous attempt

.2. Ja, en ja :




  1. Query met meerdere waarden in een kolom

  2. Databaseverbindings- of authenticatiefouten met verplaatsbaar type

  3. SQL SELECT ORDER BY meerdere kolommen afhankelijk van de waarde van de andere kolom

  4. Mac OS X + Python + Django + MySQL