February 2nd, 2009

JOIN versus WHERE (Part 3 of 3)

Posted by admin in L. JOINs

Now, instead of using the key word JOIN, we can do a join with the WHERE clause.

              WHERE syntax format:                              Example:

          SELECT select_columns                     SELECT V.VNDR_ID,
             FROM table1, table2                                     V.VENDOR_NAME,
         [WHERE join_condition]                                   I.DESCRIPTION
          [GROUP BY grouping_columns]            FROM VENDOR_TBL      V,
          [HAVING search_condition]                              INVENTORY_TBL I
          [ORDER BY sort_columns];                WHERE V.VNDR_ID = I.VNDR_ID;

Select_columns is one or more selected columns separated by a comma from table1 and table2.

The WHERE clause reflects the conditions for joining the two tables.

The results of this join, using WHERE, will produce the same results as the previous JOIN.

> The WHERE clause can also include non-join search conditions for filtering.

> The WHERE syntax is simpler and easier to understand for JOINs and most examples in this course are done using this syntax. However, both syntax formats are shown in each topic so that you can understand and use either format.

Comments are closed.

Sorry, the comment form is closed at this time.