Oracle

Cartesian product.

Figo Kim 2006. 9. 1. 17:48
When a join condition is invalid or omitted completely, the result is a Cartesian product, in which all combinations of rows are displayed.

  • All rows in the first table are joined to all rows in the second table.

  • A cartesian product is formed when:
    - A join coindition is omitted
    - A join condition is invalid
    - All rows in the first table are joined to all rows in the second table

  • To avoid a Cartesian product, always include a valid condition.

ex) SELECT last_name, department_name, dept_name FROM employees, departments;

  - No join condition is defined
  - The employees table has 20 rows and the departments table has 8 rows, so the result will have 160 rows.