SQL joins have never been my strength. I would like some help with this one. It is probably an easy one for you SQL maestros.
I have 2 tables with the same columns. Let's say their structure is:
id INTEGER PRIMARY KEY AUTOINCREMENT,
key INTEGER,
description TEXT NOT NULL,
size INTEGER,
timestamp LONG,
is_on INTEGER
The table names are Shirts1 and Shirts2. The tables represent 2 versions of a dataset, and have a high amount of data overlap. The goal is to find which rows are different. key is the key which remains the same from version to version. Remaining columns can change from version 1 to 2.
Answers should be ideally for SQLite on Android. Multiple queries are OK - need not be 1 query.
My guess
SELECT * FROM Shirts1, Shirts2 WHERE Shirts1.key=Shirts2.key AND
(Shirts1.description != Shirts2.description OR
(Shirts1.size != Shirts2.size OR
(Shirts1.timestamp != Shirts2.timestamp OR
(Shirts1.is_on != Shirts2.is_on)
Another concern is would a query like this cause issues on an Android phone with limited device memory? There are 1000 rows in both tables. Should I break out the query into multiple queries, limiting comparison to 100 rows at at time for instance, as key goes from 1-1000 in order.