Database Reference
In-Depth Information
Output
+----------------+--------------+
| cust_name | cust_contact |
+----------------+--------------+
| Coyote Inc. | Y Lee |
| Yosemite Place | Y Sam |
+----------------+--------------+
Analysis
As explained in Chapter 14, returning the data needed in this query requires
the use of three tables. But instead of using them within nested subqueries, here
two joins are used to connect the tables. There are three WHERE clause condi-
tions here. The first two connect the tables in the join, and the last one filters
the data for product TNT2 .
Tip
It Pays to Experiment As you can see, there is often more than one way to perform
any given SQL operation. And there is rarely a definitive right or wrong way. Performance
can be affected by the type of operation, the amount of data in the tables, whether
indexes and keys are present, and a whole slew of other criteria. Therefore, it is often
worth experimenting with different selection mechanisms to find the one that works best
for you.
Summary
Joins are one of the most important and powerful features in SQL, and using
them effectively requires a basic understanding of relational database design. In
this chapter, you learned some of the basics of relational database design as an
introduction to learning about joins. You also learned how to create an equi-
join (also known as an inner join), which is the most commonly used form of
join. In the next chapter you learn how to create other types of joins.
 
 
Search WWH ::




Custom Search