Check out example codes for "select true if exists on another table or false sqlserver". It will help you in understanding the concepts better.

Code Example 1

select A.name, 
       CASE WHEN B.name IS NOT NULL
       THEN 1
       ELSE 0
       END

    from table1 A
    left join table2 B
    on A.name = B.name

Learn ReactJs, React Native from akashmittal.com