Previous Topic Next topic Print topic


Multi-table Joins

The next query joins four tables in the TUTORIAL location to find the name of the customer, order date, product names, and quantities ordered -- for all orders with order number greater than three:

SELECT company, o_date, description, quantity
  FROM customer c, orders o, products p, items i
  WHERE c.c_no = o.c_no
    AND p.p_no = i.p_no
    AND o.o_no = i.o_no
    AND o.o_no > 3

The XDB Server will choose the optimal order for performing the join. Due to query optimization, a join performed on indexed columns may retrieve records in a different order than a join performed on nonindexed columns.

It is not possible to update, delete or insert into table records retrieved by performing a join. However, UPDATE and DELETE commands may contain joins embedded as subqueries in the WHERE clause to specify the target records in a table.

Previous Topic Next topic Print topic