Page 179 - IT-802_class_12
P. 179

Notes


                       We can also use LEFT OUTER JOIN instead of LEFT JOIN, both are the same.













                                           Table A                             Table B









            Example:

            SELECT EmpLOyEE.Emp_iD, EmpLOyEE.SALARy, EmpLOyEE.Emp_NAmE

            FROm EmpLOyEE
            LEFT JOiN EmpLOyEE_DETAiLS
            ON EmpLOyEE.Emp_iD = EmpLOyEE_DETAiLS.Emp_iD;
            Output:
            +--------+--------+-------------+
            | Emp_iD | SALARy | Emp_NAmE    |
            +--------+--------+-------------+
            | 03     | 18000  | NEHA_DAS    |
            | 04     | 25000  | RADHA_SiNHA |
            | 06     | 28000  | RAVi_yADAV  |
            +--------+--------+-------------+
            1.12.3 Right Join

            RIGHT JOIN is similar to LEFT JOIN. This join returns all the rows of the table on the right side of the join and
            matching rows for the table on the left side of the join. For the rows for which there is no matching row on the left
            side, the result-set will contain null. RIGHT JOIN is also known as RIGHT OUTER JOIN.
            Syntax:

            SELECT table1.column1,table1.column2,table2.column1,....
            FROm table1

            RiGHT JOiN table2
            ON table1.matching_column = table2.matching_column;
            WHERE,

            table1: First table.
            table2: Second table
            matching_column: Column common to both the tables.





                                                                                 Database Concepts—RDBMS Tool   177
   174   175   176   177   178   179   180   181   182   183   184