SQL JOIN or EXISTS? Chances Are, You’re Doing it Wrong

A lot of developers get the distinction between JOIN and SEMI-JOIN wrong. Let me explain... What are JOIN and SEMI-JOIN A little bit of relational algebra first. What is an (INNER) JOIN? An JOIN is nothing but a filtered cartesian product. And what is a cartesian product? Wikipedia explains this very nicely: for sets A … Continue reading SQL JOIN or EXISTS? Chances Are, You’re Doing it Wrong

Semi Join and Anti Join Should Have Their Own Syntax in SQL

Relational algebra nicely describes the various operations that we know in SQL as well from a more abstract, formal perspective. One of the most common relational JOIN operations is the "equi-join" or SQL INNER JOIN. The above example "equi-joins" the ACTOR, FILM_ACTOR, and FILM tables from the Sakila database, in order to produce a new … Continue reading Semi Join and Anti Join Should Have Their Own Syntax in SQL