Check on the availability of data in the database and receive a result?

Good afternoon, I have a table A, it looks like this:
And there is a table with data B
Question can I use sql like to protonirovanie table B. addressid on the coincidence of values of c A. id, and if the table has any values with the same id, then output to A table with an extra field of type hasThisIdInBTable: true/false
if in Sql there is such possibility, how it can be implemented?
March 25th 20 at 12:52
2 answers
March 25th 20 at 12:54
select ... exists(select 1 from B where B. addressid = A. id) as hasThisIdInBTable from A;
March 25th 20 at 12:56
To all A. id for which there is a B. addressid:
LEFT JOIN B ON (B. addressid=A. id)
WHERE B. addressid IS NOT NULL
And right join to register not? Why the extra condition in the sample? - Coralie.Paucek commented on March 25th 20 at 12:59

Find more questions by tags SQL