Is there a way to insert a group of items that are dependent but consistent between them with unique primary keys and foreign keys but that are colliding with items in database.
For example, given a table
id primary key, name
and a table
id primary key, name, id_a' -- foreign key on A
I want to insert:
INSERT INTO A(id, name) VALUES (1, "a"); INSERT INTO B(id, name, id_a) VALUES (1, "b", 1);
But the keys
B.id could be taken already. Is there a way to insert my elements with auto setting key and foreign keys in a consistent way without colliding with existing elements?