If you do not want the letters in the list that are in the database, you can do the following:
select u.name , u.EMAIL , a.emailadres , case when a.emailadres is null then 'Not exists' else 'Exists' end as 'Existence' from users u left join ( select 'email1' as emailadres union all select 'email2' union all select 'email3') a on a.emailadres = u.EMAIL)
this way you get a result like
name | email | emailadres | existence -----|--------|------------|---------- NULL | NULL | a@b.com | Not exists Jan | j@j.nl | j@j.nl | Exists
Using the IN or EXISTS statements is harder, then the left join in this case.
Good luck :)
Mark Kremers Feb 02 2018-12-12T00: 00Z
source share