5

https://stackoverflow.com/questions/5243131/sqlite-importing-data-from-a-datadump-script-including-primary-and-foreign-keys

<snip>

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.

  • you want that migrated to dba? remember we try to avoid migrations in beta until a site us public, except in exceptional cases. – Jeff Atwood Mar 11 '11 at 9:13
  • 2
    @Jeff ~ I meant in the sense of do we want to welcome those questions over here. Remember, we're trying to define our community, yes? So the more concensus we have "this is good, this is not good" the better. It would be nice to goto SO and offer the user to cross post to see if better answers can be had here. I understand not migrating, but there's also a definitive distinction in regards to asking them to cross-post. ~~~ takeaway: site definition by example. – jcolebrand Mar 11 '11 at 15:27
  • well said. I think we should update over faq based on these suggestions What kind of questions are allowed on Database Administrators ? – CoderHawk Mar 14 '11 at 20:10
5

I think, it is OK for dba..stackexchange. Focus is not on programming.

  • @berndK - I second. – CoderHawk Mar 14 '11 at 20:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .