What is the difference between CROSS JOIN and multiple tables in one FROM?

后端 未结 2 1509
刺人心
刺人心 2021-01-23 05:14

What is the difference?

SELECT a.name, b.name
FROM a, b;

SELECT a.name, b.name
FROM a
CROSS JOIN b;

If there is no difference then why do both

2条回答
  •  情深已故
    2021-01-23 06:09

    Both expressions perform a Cartesian product of the two given tables. They are hence equivalent.

    Please note that from SQL style point of view, using JOIN has been the preferred syntax for a long time now.

提交回复
热议问题