I am feeling quite tired today especially because it is that special part of the month. I think females will be able to easily relate. To add to my daily learnings, I reviewed the concept of Left Semi Join (WHERE EXISTS). This was an interesting join to know about especially because standard inner joins may show duplicate results which can be easily avoided using Left Semi Join. Well, you could use distinct but that might not always be efficient.
SELECT
names.iid,
names.first_name
FROM names
WHERE EXISTS (
SELECT 1 --- this subquery doesn't show any results
FROM new_jobs
WHERE names.iid = new_jobs.iid
);

Leave a comment