I'm having some trouble using sqlite3 to join records. I have two tables: tableA and tableB. tableA has the columns col1 and col2, while tableB has col3 and col4. I want to join col4 to tableA, based on the information in col2 and col3. So I added another column, col 5 to tableA and tried:
UPDATE tableA
SET col5 =
(SELECT col4 from tableB
WHERE tableA.col2 = tableB.col3);
My tableA is about 300,000 rows, and tableB is more than a million rows, and this takes really long to run.
I understand that there is a way to do the same using a JOIN clause. So my questions are:
1. Will it matter? will it run faster if I use JOIN?
2. How do you do that using a join?
3. Are there other ways to improve performance?
Thanks a lot!