There are times when the data you need to extract from a database are spread across multiple tables and the way to combine the required data from multiple tables is via table joins. This beginners course will explain some of the types of table joins available in Oracle .
A join is a query that combines rows from two or more tables or views. Oracle Database performs a join whenever multiple tables appear in the FROM clause of the query. The select list of the query can select any columns from any of these tables. If any two of these tables have a column name in common, then you must qualify all references to these columns throughout the query with table names to avoid ambiguity.
There are certain conditions that has to be met before Joins can be implemented.
Most join queries contain at least one join condition, either in the FROM clause or in the WHERE clause. The join condition compares two columns, each from a different table. To execute a join, Oracle Database combines pairs of rows, each containing one row from each table, for which the join condition evaluates to TRUE. The columns in the join conditions need not also appear in the select list.
To execute a join of three or more tables, Oracle first joins two of the tables based on the join conditions comparing their columns and then joins the result to another table based on join conditions containing columns of the joined tables and the new table. Oracle continues this process until all tables are joined into the result.
The types of joins we will cover include:
- Extracting data using Equi Join
- Extracting data using Non- Equi Join
- Extracting data using Cartesian Join
- Extracting data using Outer Join
- Extracting data using Self Join