O'Reilly logo

Sams Teach Yourself SQL in 10 Minutes by Ben Forta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Join

Creating a join is very simple. You must specify all the tables to include 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

Let's take a look at the preceding code. The SELECT statement starts in the same way as all the statements you've look at ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required