Sobes.tech
Junior — Middle

What is the difference between using LEFT JOIN and LEFT OUTER JOIN in PostgreSQL when joining tables?

sobes.tech AI

Answer from AI

In PostgreSQL, LEFT JOIN and LEFT OUTER JOIN are synonyms and work the same way. Both return all rows from the left table and the matching rows from the right table, if any; if there are no matches, the right table's fields will be filled with NULL.

Example:

SELECT a.id, b.value
FROM table_a a
LEFT JOIN table_b b ON a.id = b.a_id;

Here, LEFT JOIN is equivalent to LEFT OUTER JOIN.

Therefore, there is no difference in behavior between them, and OUTER can be omitted for brevity.

What is the difference between using LEFT JOIN and… - sobes.tech