user1050619
user1050619

Reputation: 20856

writing joins in mulitple ways in postgres

I noticed the same join can be written in two different ways as mentioned below. I don't see any change in the result.

Is this different format just for readability?

Pattern-1:

select * from 
(
  Table-1 A
  LEFT JOIN Table-2 B ON ((A.id = A .id))
);

Pattern-2:

select * from 
Table-1 a
LEFT JOIN Table-2 B on B.id = A.ID

Upvotes: 0

Views: 42

Answers (1)

Stefan Winkler
Stefan Winkler

Reputation: 3956

Both statements are equal.

The SQL parser internally would regard the braces as present, because they implicitly are. But without braces it's much easier to read (at least for these short statements)

Upvotes: 1

Related Questions