MYSQL | Handling INSERT records on database engine

39 Views Asked by At

In MYSQL DB I have a table in which I store large amount of records for processing.

I have 4 attributes in a table, but only one is always different per record per INSERT. Other 3 attrs are like helpers to the main attribute.

Similar like this:

country_id: int [123]
person_id: int 
timestamp: int [X]
flag: boolean [0]

So, For a given list of 2 milion persons' ids and given contry_id (same contry id for every person). I want to insert it in a single INSERT command (or few of them), without preparing records on app processor.

I need INSERT QUEUE LIKE this:

INSERT INTO table (country_id, person_id, timestamp, flag)
VALUES
('123', '111111', X, 0),
('123', '222222', X, 0),
('123', '333333', X, 0);

But, to be prepared on DB layer.

Thank you.

0

There are 0 best solutions below