SQL INNER JOIN .

SQL Using Inner JOIN.

  • INNER JOIN is the same as JOIN.
  • JOIN - Return rows when there is at least one match in both of two tables.

    Pictorial representation :

  • A skeleton syntax version of JOIN using the ON keyword is this:
    SELECT select_list
    FROM table_1  [INNER] JOIN table_2
    ON [table_1.]column  join_operator  [table_2.]column
    [WHERE search_conditions ]
    [ORDER BY column1, column2, ... ]
    Example using JOIN between the tables with ON:
    SQL server, MySQL, Oracle, PostgreSQL :
    Select First_name "First name",
      Last_name "Last name",
      email, Telephone_type "Phone type",
      Telephone_number as "Phone number"
     from customers c
     INNER JOIN telephones t     /* or: JOIN telephones t*/
     ON c.customer_id=t.customer_id
     where  t.Telephone_type<>'Unknown'
     order by Last_name;
    The result should be:
    First name Last name email Phone type Phone number
    Judith Bowman J.Bowman@imb.com Cell (371) 153-54
    Judith Bowman J.Bowman@imb.com Work (371) 143-54
    Ricard Nixon Ricard.Nixon@hotmail.com Work (978) 667-94
    Ricard Nixon Ricard.Nixon@hotmail.com Home (978) 667-94
    Robert Redford R.Redford@google.com Home (679) 234-94
© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.