0
CREATE TABLE a (aid int);
CREATE TABLE b (bid int);
INSERT INTO a VALUES (1), (2), (3);
INSERT INTO b VALUES (2), (3), (4);

What would be the difference between

SELECT * FROM a, b WHERE aid = bid; and

SELECT * FROM a JOIN b ON a.aid=b.bid;

The result of explain analyze for both queries looks totally same.

Kir
  • 7,823
  • 12
  • 50
  • 68
  • 2
    Use only `JOIN` syntax. Comma syntax is old and obsolete. With outer join you need to use error prone `*=` or `=*` operators. – Lukasz Szozda Nov 07 '15 at 12:33
  • @lad2025: There is not such operator `*=` or `=*` in (standard) SQL and definitely not in Postgres. – a_horse_with_no_name Nov 07 '15 at 12:57
  • @a_horse_with_no_name `(+)=` or `*=` are Oracle/SQL Server specific. But it doesn't change the fact that the comma syntax join is obsolete and should be avoided. – Lukasz Szozda Nov 07 '15 at 13:08

1 Answers1

-1

Both queries do exactly the same.