Database Reference
In-Depth Information
| Jouets Et Ours | Oil can | 8.99 |
| Jouets Et Ours | Safe | 50.00 |
| Jouets Et Ours | Sling | 4.49 |
| Jouets Et Ours | TNT (1 stick) | 2.50 |
| Jouets Et Ours | TNT (5 sticks) | 10.00 |
| LT Supplies | .5 ton anvil | 5.99 |
| LT Supplies | 1 ton anvil | 9.99 |
| LT Supplies | 2 ton anvil | 14.99 |
| LT Supplies | Bird seed | 10.00 |
| LT Supplies | Carrots | 2.50 |
| LT Supplies | Detonator | 13.00 |
| LT Supplies | Fuses | 3.42 |
| LT Supplies | JetPack 1000 | 35.00 |
| LT Supplies | JetPack 2000 | 55.00 |
| LT Supplies | Oil can | 8.99 |
| LT Supplies | Safe | 50.00 |
| LT Supplies | Sling | 4.49 |
| LT Supplies | TNT (1 stick) | 2.50 |
| LT Supplies | TNT (5 sticks) | 10.00 |
+----------------+----------------+------------+
Analysis
As you can see in the preceding output, the Cartesian product is seldom what
you want. The data returned here has matched every product with every ven-
dor, including products with the incorrect vendor (and even vendors with no
products at all).
Caution
Don't Forget the WHERE Clause Make sure all your joins have WHERE clauses, or
MariaDB returns far more data than you want. Similarly, make sure your WHERE clauses
are correct. An incorrect filter condition causes MariaDB to return incorrect data.
Tip
Cross Joins Sometimes you'll hear the type of join that returns a Cartesian product
referred to as a cross join .
Inner Joins
The join you have been using so far is called an equijoin —a join based on the
testing of equality between two tables. This kind of join is also called an inner
join . In fact, you may use a slightly different syntax for these joins, specifying
the type of join explicitly. The following SELECT statement returns the exact
same data as the preceding example:
 
 
Search WWH ::




Custom Search