Skip to content
Advertisement

join without a join in PostgresSQL

I have code with the following psql query that I try to understand (It was simplified for the question):

Is it the same as doing a join, or am I missing something here?

Advertisement

Answer

You are doing an old school implicit join. This is the syntax used before the ANSI-92 SQL standard which started recommending explicit joins like this version of your query:

The above version is considered the “correct” way of expressing your logic. Explicit joins solved a number of problems inherent with implicit joins. Implicit joins place both the join logic and the filter criteria into the same WHERE clause, potentially making it difficult to tease apart what is happening there. In addition, it was harder to express left/right/inner/cross join using the implicit syntax, with different vendors sometimes having different syntax. The ANSI-92 explicit join is pretty much the same across all the major SQL vendors at this point.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement