I have a SQLite database that makes use of foreign keys, some of which will be autoincremented values. The "core" data the system represents is for example a car. The foreign keys are linking to information about wheels and tires for example, and I wish to export n cars from one database and import into another.
I want to do this by writing a set of sql statements (i.e a bunch of insert statements) that can be loaded by the importing database, but the key values in the dumped data will not necessarily match up with the existing data (maybe there are duplicates in some of the key values).
What is the best way to deal with this? Is there an easy or recommended way to write the import script so that dependencies on exported key values are removed?
and then there's DDL
I want it, I want to make sure anybody else here thinks it helps us more. I think it's more than just "how do I write this SQL" because it's about the method of writing a correct set of queries for exporting the data.