Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a query with table separated by comma a cross join query?

Tags:

sql

operation

I know some of SQL but, I always use join, left, cross and so on, but in a query where the tables are separated by a comma. It's looks like a cross join to me. But I don't know how to test it (the result is the same with the tries I made).

SELECT A.id, B.id
FROM A,B
WHERE A.id_B = B.id

Even in the great Question (with great answers) "What is the difference between Left, Right, Outer and Inner Joins?" I didn't find an answer to this.

like image 731
Michel Ayres Avatar asked Feb 13 '23 05:02

Michel Ayres


1 Answers

It would be a cross join if there wasn't a WHERE clause relating the two tables. In this case it's functionally equivalent to an inner join (matching records by id_rel and id)

It's an older syntax for joining tables that is still supported in most systems, but JOIN syntax is largely preferred.

like image 98
D Stanley Avatar answered Feb 16 '23 10:02

D Stanley