Topic: Import existing database

How can I import existing SQLite database? I have converted my csv file via RSQLite library using software R and saved the database as mydb.sqlite, all I see in the intro videos is how to create/insert data table. But I have already database table.

So if this is not the way to go you mention in other post that other way to imprt csv file is to use SQLite studio. I have successfully loaded mydb.sqlite into the SQLite studio so how to proceed next? Do you have any source/material available or a tutorial to use?

Thanks.

2 (edited by tcoton 2015-12-22 09:36:51)

Re: Import existing database

Since Myvisualdatabase requires an id column for each table, the way I proceed for bulk import is as follow:

1 - I prepare all tables in myvisualdatabase, save the project and close it.
2 - I open the SQLite.db with SQLite studio
3 - I create a copy of the table I want to import data into without the id column
4 - I import data into this copy using csv file
5 - I run a query to insert the data into target table like this :

INSERT INTO target_table_name [(column1, column2, ... columnN)] 
   SELECT *
   FROM temporary_table_name
   [WHERE condition];

6 - I delete the temporary table

In the FAQ, you could find a script to import data into your project using a scripted button http://myvisualdatabase.com/forum/viewtopic.php?id=1448. The csv must be well prepared though, the column order must match the table, no header and separator is semi-colon ";"