Professional Documents
Culture Documents
•
•
•
•
•
Cartesian Product
or
Cross Join of tables
Cartesian Product of two tables is a table obtained by pairing up each
row of one table with each row of the other table without any
condition.
Eg:
Table A contain 3 rows and 4 columns
Table B contains 2 rows and 3 columns
Cartesian product will contain
6 (=3x2) rows and 7 (=4+3) columns
Cardinality:
Number of records/rows/tuples in a table.
Degree:
Number of columns/attributes/columns in a table.
Cardinality : 6
Degree: 5
SQL query to find the Cartesian Product
Consider the tables product and order_table,
Equi Join
Equi Join
Natural Join
Natural Join
Natural Join
Natural Join
SELECT column_name(s)
FROM table1 T1, table1 T2
WHERE T1.colname1=T2.colname2;
Self Join
A self join is a regular join, but the table is joined with itself.
Self Join>>