Overview
In this chapter, students learn how to retrieve data from two or more tables using one SQL
command. Students join tables and examine how similar results are obtained using the IN
and EXISTS operators. Then, students use aliases to simplify queries and join a table to
itself. Students also implement the set operations of union, intersection, and difference
using SQL commands. They examine two related SQL operators: ALL and ANY. Finally,
students perform inner joins, outer joins, and products.
Chapter Objectives
In this chapter, students learn about:
• Using joins to retrieve data from more than one table
• Using the IN and EXISTS operators to query multiple tables
• Using a subquery within a subquery
• Using an alias
• Joining a table to itself
• Performing set operations (union, intersection, and difference)
• Using the ALL and ANY operators in a query
• Performing special operations (inner join, outer join, and product)
Teaching Tips
Querying Multiple Tables
1. Many queries require the retrieval of data from two or more tables. This type of
retrieval requires that the tables be joined.
3. Point out the Note on page 133.
Joining Two Tables
2. Use Example 1 and Figure 5-1 to illustrate joining two tables using the WHERE clause.
(1) In the SELECT clause, list all columns you want to display.
(3) In the WHERE clause, list the condition that restricts the data to be retrieved to only