Database Reference
In-Depth Information
might think that you can restrict this by specifying only certain column names in the select
statement. This works to an extent, as you can see if you run the following query:
SELECT cookieid
FROM
log,webpage
Even though the results now contain only one column, the query has still returned 35
rows, as can be seen in Figure 7.3.
Be careful when using cross joins; they are of little use and can cause incredible per-
formance hits on your database system if you join big tables together. Try cross joining your
webpage , log , cookies and visitorbook tables together and you will see how quickly this can
get out of hand. Joining a few little tables produces a huge result set.
Inner Joins
The cross join as described above is an inner join. Simply put, inner joins require a match
between both tables that are being joined. If no match is specified then all rows are matched
such as in the cross join.
Equi-join
An inner join that is more useful than the cross join is the equi-join. In an equi-join you
specify something to match between the tables being joined, which results in a much more
controlled join. The basic format of such a join is as follows:
SELECT columns
FROM
table1, table2, etc
WHERE
condition
Figure 7.3
A cross join restricted to a single column.
Search WWH ::




Custom Search