Oracle cartesian product vs. join
cartesian-product, join, oracle, sql
Solution
What is the database doing in a situation like this?
The same as when you specify an ANSI join:
SELECT *
FROM orders o
JOIN products p ON o.productid = p.id
I've noticed everybody writes their queries like this [...]
It looks like lots of people in your company got many years of experience in Oracle! I bet they also use `(+)` notation for outer joins. This was the only syntax supported by Oracle prior to the 9i release.
Problem
In my company we use an Oracle database. I've noticed everybody writes their queries like this: ``` SELECT p.name, p.id, o.issued_date FROM orders o, products p WHERE o.productid = p.id; ``` What is the database doing in a situation like this? Making a Cartesian product and then selecting only certain rows? That just doesn't sound right.