I’ve two tables in SQLite:
Table1:
-------
id
name
Table2:
-------
id
temp_name
My question is, how do I write an SQL query that returns names in Table2 that are not in Table1?
For example:
Table1:
-------
1, 'john'
2, 'boda',
3, 'cydo',
4, 'linus'
Table2:
-------
1123, 'boda'
2992, 'andy',
9331, 'sille',
2, 'cydo'
In this example the SQL query should return elements andy, and sille from Table2, because they’re not in Table1.
This is how to do it in “obvious” standard SQL:
There are other methods, such as using
left outer join,existsin thewhereclause, and theexceptoperation.