previous | index | next

Selecting From Multiple Tables—Table Joins

Suppose we want the names of customers who placed orders on May 1, 2004.

There is no single table with both customer name and order information. So:

   SELECT name FROM customer, sales_order 
   WHERE customer.id = customer_id AND
         order_date = '2004-05-01'; 

   SELECT customer.name FROM customer, sales_order 
   WHERE customer.id = sales_order.customer_id AND
         sales_order.order_date = '2004-05-01'; 

previous | index | next