DEV Community

loading...

Discussion on: SQL Joins without the Venn diagrams

Collapse
aarone4 profile image
Aaron Reese

In 20 years of writing SQL I have never found a legitimate use for RIGHT JOIN in production code. RJ indicates you don't understand your data as it can always be rewritten as a LJ.

One issue that often catches new users is the filter predicate. If you apply it to the Join clause on a LJ you only drop the joined record,; if you add it to the WHERE clause you drop the entire row.

Collapse
helenanders26 profile image
Helen Anderson Author

Great advice! Thanks for sharing :)