Oracle Join Operations
A Join is the process of combining data from two or more tables. The DBMStakes all combinations of rows from the given tables.
Join without filter conditions. A Cross Join is the Cartesian product or the result of all possible combinationsof the rows from each of the tables involved in the join operation.This occurs when, no specific Join conditions (filters) are specified. For eg:there are 3 tables A,B and C with 10,20 and 30 number of rows respectively.So a cartesian production would happen in the below scenario,
Select A.col1, B.col2, C.col3 from A, B, C
--No ‘where condition’ which returns 10x20x30=6000 records are result. Thus the number of rows in a Cartesian product of two tables is equal to thenumber of rows in the first table times the number of rows in the second table.Never use this kind of joins unless unavaidable as this takes huge amount of memory to sort and store
(ANSI Joins)These are ANSI Joins which are used for portability. You can use this inalmost all Standard Databases like Oracle, Microsoft SQL Server etc. SELECT DNAME, ENAME, MGRFROM DEPARTMENTS
EMPLOYEES; PS: Both tables should have primary key-referential key relationship.
Sometimes there are scenarios where we might need to do Join operationswithin the same table. Such joins which refers to the same, single tableare known as a Self Joins