Creating a Join

Creating a join is very simple. You must specify all the tables to be included and how they are related to each other. Look at the following example:

SELECT vend_name, prod_name, prod_price
FROM Vendors, Products
WHERE Vendors.vend_id = Products.vend_id;
vend_name                  prod_name                prod_price
-----------------------    ---------------------    ----------
Doll House Inc.            Fish bean bag toy        3.4900
Doll House Inc.            Bird bean bag toy        3.4900
Doll House Inc.            Rabbit bean bag toy       3.4900
Bears R Us                 8 inch teddy bear         5.9900
Bears R Us                 12 inch teddy bear        8.9900
Bears R Us                 18 inch teddy bear        11.9900
Doll House Inc.            Raggedy Ann               4.9900
Fun and Games              King doll                 9.4900
Fun and Games              Queen doll                9.4900

Let's take a look at the preceding code. The SELECT statement ...

Get Sams Teach Yourself SQL in 10 Minutes, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.