Joins allow you to combine data from multiple tables.
```SQL
SELECT *
FROM <table1>
JOIN <table2> ON <table1.field> = <table2.field>;
```
An equivalent syntax (sometimes referred to as an **implicit** join) is
```SQL
SELECT *
FROM <table1> A, <table2> B
WHERE A.<field> = B.<field>
```
## outer join
An outer join will include all the rows from the LEFT or RIGHT table even if the keys don't match. This is useful when you want to make sure you have all of the records from the first table when joining the second table even if the record does not have a match in the second table.
## Cartesian product
The Cartesian product repeats the entirety of the second table for each row of the first table.
The Cartesian product is often created by mistake in SQL queries. In a Join, we would only be interested in the rows where some key in table 1 equals a key in the second table. Without this constraint, we get an unqualified join or Cartesian product. Aggregation functions will be inaccurate if mistakenly run on the Cartesian product. Typically this occurs when joining more than two tables and forgetting to include the join condition for one or more joins. For $M$ joins, ensure you have $M-1$ join conditions.