## 28.2.5 Joins (cont.)

- E.g., find all cities that received a hair dryer:
  - Use Product table to match 'Hair Dryer' to items
  - Use Item table to find invoices
  - Use Invoice table to find customers
  - Pull info from Customer table

  >     SELECT Customer.City, Customer.State, Customer.Zip
  >        FROM Product, Item, Invoice, Customer
  >        WHERE Product.Description = 'Hair dryer'
  >           AND Product.Product_Code = Item.Product_Code
  >           AND Item.Invoice_Number = Invoice.Invoice_Number
  >           AND Invoice.Customer_Number
  >              = Customer.Customer_Number

Anytown | CA

prev |top |next