Simple join
The following query is an example of a simple join on
the customer and cust_calls tables.
Figure 1. Query
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;
The query returns only those rows in which the customer
has made a call to customer service, as the result shows.
Figure 2. Query result
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.