If you want to get data (rows) from a table which are not in other table:
For example, You have two tables, table1 and table2. You want to get data in table1 which are not in table2 . there is a common field that common field that id. Then you need to use such query:
SELECT * FROM table1 WHERE NOT EXISTS (SELECT id FROM table2 WHERE table1.id=table2.id);
If you want to reverse, data from table1 which are also in table2.
SELECT * FROM table1 WHERE EXISTS (SELECT id FROM table2 WHERE table1.id=table2.id);
this is same with general sql query :
SELECT * FROM table1, table2 WHERE table1.id = table2.id;










