About
Relational Operator - Join in SQL.
A join is a SQL clause statement which define the set operation such as:
that the database must perform between two or more relation (table, view, query, …).
The result set is beautifully illustrated with a wiki/Venn_diagram.
The tables usually have a parent-child relationship.
If a query does not contain a join, the database returns a result set that contains all possible combinations of the rows in the query tables. Such a result set is known as a Cartesian product.
You use joins to ensure that queries returning data from multiple tables do not return incorrect results. A join between two tables defines how data is returned.
A join is characterized by multiple tables in the FROM clause, and the relationship between the tables is defined through the existence of a join condition in the WHERE clause.
Cardinalities further describe a join between 2 tables by stating how many rows in one table will match rows in another.
In a join :
- one row set is called inner
- and the other is called outer.
Disambiguation: The term join can be use to define:
- A join clause in a sql statement (or in a data modelisation)
- but also to describe a join database operation (an algorithm) that perform the database to retrieve the data in order to serve the SQL statement.
Articles Related
Syntax
Type of Joins
-
- range join
- data type conversion join
SQL Join Problems
In the design of a semantic layer (such as a universes for BOBJ or the repository for OBIEE), you may need to resolve join problems such as :
- and fan traps,
which may occur in the structure by using aliases and/or contexts.