1
Reply

What is the basic rule to join 2 tables ?

Ravi Kumar

Ravi Kumar

Apr 10, 2013
1.1k
0

    Joining more than two tablesJoins are not limited to two tables. You can join more than two tables in a single SQL statement.Inner joinsAn inner join is a method of combining two tables that discards rows of either table that do not match any row of the other table. The matching is based on the join condition.Outer joinsAn outer join is a method of combining two or more tables so that the result includes unmatched rows of one of the tables, or of both tables. The matching is based on the join condition.Full outer joinAn full outer join is a method of combining tables so that the result includes unmatched rows of both tables.Left outer joinA left outer join is a method of combining tables. The result includes unmatched rows from only the table that is specified before the LEFT OUTER JOIN clause.Right outer joinA right outer join is a method of combining tables. The result includes unmatched rows from only the table that is specified after the RIGHT OUTER JOIN clause.SQL rules for statements that contain join operationsTypically, DB2 performs a join operation first, before it evaluates the other clauses of the SELECT statement.Sample data for joinsYou can use the sample PARTS table and the PRODUCTS table to practice various types of joins.

    Abhay Shanker
    November 27, 2013
    0