Creating Joins with JOIN or WHERE

You have two alternative ways of specifying a join: by using JOIN syntax or WHERE syntax. The ANSI SQL-92 standard prescribes JOIN syntax, but older SQL standards prescribe WHERE; hence, both JOIN and WHERE syntax are legal in most DBMSes.

Both types of syntax are used widely, so I’ll give examples that show how to implement equivalent JOIN and WHERE queries. JOIN queries will be in the main text, and the equivalent WHERE queries will be in the Tips.

In this section, I’ll show you the general syntax for JOIN and WHERE joins that involve two tables. The actual syntax that you’ll use in real queries will vary by the join type, the number of columns joined, the number of tables joined, and the syntax requirements ...

Get SQL: Visual QuickStart Guide now with the O’Reilly learning platform.

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