目前,我有apprx。 20相同的结构化数据库(SQLite的)这是我从遥远的目的地(Android手机),以我的电脑转移。现在我想将它们添加到一个单一,以进行数据分析上的数据。这怎么可能?该表的主键是自动递增的整数,因此当使用附加我得到一个主键是不唯一的错误。此外,它会很好,如果我能以某种方式让它们来自何处行和表之间的参考。
At the moment I have apprx. 20 identical structured databases(SQLite) which I transferred from remote destinations (android phones) to my pc. Now I want to add them to a single one in order to perform data analysis on the data. How is this possible? The primary keys of the tables are auto-increment integer , so when using ATTACH I get a Primary key is not unique error. In addition it would be nice if i could somehow keep a reference between the rows and the tables which are coming from.
推荐答案你措辞的问题的方法,这听起来好像是一个一次性的操作,你正在做一台家用电脑上。我想可能只是打开了 sqlite的外壳一个全新的数据库,并附加/从插入/分离的每个数据库像他们展示在的链接。
The way you worded the question, it sounds to me like it is a one-time operation you're doing on a home PC. I would probably just open a fresh database in the sqlite shell and attach/insert from/detach each database like they show on that link.
如果你需要这个脚本,此链接具有嵌入到sqlite的一个例子shell脚本和这个显示了DOS批处理文件中的一些SQL。更多preferably,你可以$ C C $它与你喜欢的语言的SQLite的绑定,如 Python的。
If you need to script this, this link has an example of embedding sqlite into shell scripts and this one shows some sql in a dos batch file. More preferably, you could code it up with your favorite language's sqlite bindings, like Python's.
更多推荐
合并数据库
发布评论