O'Reilly logo

SQL: Visual QuickStart Guide by Chris Fehily

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 Natural Join with NATURAL JOIN

A natural join:

  • Is a special case of an equijoin; it compares all the columns in one table with corresponding columns that have the same name in the other table for equality.

  • Works only if the input tables have one or more pairs of meaningfully comparable, identically named columns.

  • Performs joins implicitly. Don’t specify an ON or USING clause in a natural join.

  • Is a syntactic convenience that always can be replicated explicitly with an ON clause in JOIN syntax or a WHERE clause in WHERE syntax.

To create a natural join:

  • Type:
    SELECT columns
      FROM table1
      NATURAL JOIN table2
    							
    columns is one or more comma-separated expressions or column names from table1 or table2. Your DBMS may require identical column ...

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