Asiri Dissa Asiri Dissa - 23 days ago 9
SQL Question

Select from Table1, Table2

I found a the following query and appreciate if anyone can give the exact meaning of this.

select * from table1, table2


This is called CROSS JOIN but in an old syntax with , in FROM clause.

It produces a cartesian product, so the number of rows in the result set will be the number of rows from table1 multiplied by number of rows from table2 (assuming there are no constraints in the WHERE clause). It effectively pairs each row from table1 with a row coming from table2.

Below query is an equivalent but does explicit JOIN operation which separates constraint logic of data retrieval from logic of connecting related data stored across separate tables:

FROM table1