I want to store in a SQLite database a lot of tuples of the form (word1, word2, score). Since there are many repetitions of word1 and word2, to save space and have something more compact, I created three tables with the fields:
- Table0 (id1, id2, score)
- Table1 (id, word1)
- Table2 (id, word2)
where id1 and id2 are the foreign keys referring to the primary key ID of Table1 and Table2.
At the beginning I was doing this with just one table (word1, word2, score) and since I have a lot of rows, to make the insertion faster, I was using INSERT INTO
with UNION SELECT
as this is explained here: Is it possible to insert multiple rows at a time in an SQLite database?
Is there a similar way to insert multiple rows at the same time with SQLite when we have foreign key constraints?