Check out example codes for "sql select where id not exists in another table". It will help you in understanding the concepts better.

Code Example 1

where ID not in(select ID from T2 where HISTORY_FLG!=1)

Learn ReactJs, React Native from akashmittal.com