简单连接

以下查询是 customercust_calls 表上简单连接的示例。

图: 查询

SELECT c.customer_num, c.lname, c.company, 
          c.phone, u.call_dtime, u.call_descr
          FROM customer c, cust_calls u
          WHERE c.customer_num = u.customer_num;
该查询只返回客户已致电客户服务中心的那些行,如下所示。

图: 查询结果

customer_num  106
          lname         Watson
          company       Watson & Son
          phone         415-389-8789
          call_dtime    1998-06-12 08:20
          call_descr    Order was received, but two of the cans of 
          ANZ tennis balls within the case were empty
          ⋮
          customer_num  116
          lname         Parmelee
          company       Olympic City
          phone         415-534-8822
          call_dtime    1997-12-21 11:24
          call_descr    Second complaint from this customer! Received 
          two cases right-handed outfielder gloves (1 HRO) 
          instead of one case lefties.