Skip to content
Advertisement

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

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.

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement